I finally got apache2 with mod_wsgi working on Linux (havent much luck with windows :D) and everything works fine, but now when I added flatpages to my project, I found out that Apache doesn't seem to be aware of URL for admin when trying to create new flatpage via admin.
It says
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1/admin/flatpages/flatpage/1/
And now I noticed that when I'm on admin front page, and hit F5 again and again, flatpages admin appears and disappears, but nothing like this happens when using dev server, so I'll try to create new project with default setting and see what it'll do in apache and in dev server, did anyone came across this kind of error?
The Django dev server auto-reloads your code when you change it, but Apache does not.
If you are running mod wsgi in daemon mode, you can reload the code by touching the wsgi script.
touch myproject/mysite.wsgi
Otherwise, you may have to restart apache. For example
/etc/init.d/apache2 restart
Related
Django Admin Site was working fine on local server.
But the same thing when deployed on server. Admin CSS misbehaves See Screenshot Admin panel screenshot on server
admin panel site also working fine on mobile responsive view or small screens
On localhost it looks something like this.
I have ran collect static several times on server but nothing happens.
Tried Clearing Cache many time.
Nothing worked
But localhost seems to work fine
I find answer myself.
Initially a old version of site already working on server.
Then i added django.contrib.sites for django.contrib.sites
Upon adding that when update is pushed to server then
python manage.py collectstatic
command does not completely replace old files.And It doesn't work well with old files.
So run collectstatic command on local
upload generated folder to
server to avoid any such issues
I have a test site which I am (trying) to get deployed to an Ubuntu 16.04 server.
If I run the site using the Django server (python manage.py runserver 0.0.0.0:8000), I can see all of the apps when I visit the admin page as the superuser, and everything is fine.
However, when I run the site normally, using wsgi, the only apps I can see (and interact with) in the admin are for the users and groups. None of the apps I have created are visible, and if I try and navigate to a change list page for one of them for example, I get a page not found.
I believe my mod_wsgi set up is ok, in that I can view the admin and login, so I don't believe this is the problem.
Perhaps it's a permissions issue?
Any help much appreciated!
UPDATE
In the django shell, on the server, I have run
from django.conf import settings
print(settings.INSTALLED_APPS)
and this prints out the list of apps I would expect to be displayed in the admin
UPDATE 2
Having come back to the live site overnight, the apps are now showing in the admin - but I have no idea why, because they weren't yesterday and I haven't made any changes.
im running django development server and all models works fine..
But when i have configured and run apache through wsgi, only "Groups" and "Users" could be administrated, my own models disappears:
screenshot of admin pages from development server and production server
Why, please?
(After first comments here is my edit:)
I want to use django on localhost only, to fill and administrate small database file. Project is not intended for web hosting yet. I have no html views and templates defined. So I have try some simple view for testing purposes only, and problem is the same. Web server cant find some includes..:
image2: simple view also dosen't work
Make sure your production settings file has all the apps included. Normally when you don't see your admin models its due to the app missing from the list of apps included in settings.py.
Had the exact same problem. Had to restart uwsgi
sudo service uwsgi restart
Maybe for you it's wsgi or apache. Something in the pipeline needs to know you changed some python code.
I am brand new to web app development and thought I would try django as I am familiar with python. I followed the following guide: http://www.lennu.net/2012/05/14/django-deployement-installation-to-ubuntu-12-dot-04-server/ to deploy a django page to the letter. However, I now realize that this guide was for the server version of the OD and i'm running the desktop version. When I try to open my site in chrome (amitash.r) it fails with a page not found. Now when I open localhost, I get an internal server 500 error. All my config files are exactly as stated in the guide. Any fixes?
Can you post your mod_wsgi script and Apache VirtualHost file?
Following the instructions from the link you gave, the mod_wsgi script should be in:
/srv/my_project/app/conf/apache/django.wsgi
The VirtualHost file location from the link should be:
/etc/apache2/sites-available/DOMAIN
Make sure you enabled your site. If you named your file DOMAIN, like the instructions, you should enable the site using:
a2ensite DOMAIN
I am facing an interesting problem where I'm unable to login to the admin page of my app when I access it through wsgi in apache.
However when I try to access it through the django dev server it works just fine.
I don't get a wrong login warning I just see an get redirected to the same page as if nothing happened. Putting in wrong credentials does prompt that I have put in wrong credentials.
The only difference between dev server and the apache should be the I'm using virtualenv when creating the django dev server.
I've made sure to remove the standard paths from the sys.path and make it identical to when the virtual env is invoked.
I'm not seeing anything in the apache logs either.
Thanks!