Reputation: 458
I'm unable to deploy my django site using mod_wsgi after a a few frustrating days of trying. Could someone sanity check these details and see if there's anything obviously wrong? This is my first Django deployment. Its been running file with python manage.py runserver 10.10.10.214:8080
but I cannot deploy
my wsgi.py
file in /home/user/django/mysite
(also where my settings.py etc are)
"""
WSGI config for myproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
my apache .conf file:
LoadModule wsgi_module /home/conf/apache2/modules/mod_wsgi.so #dont read into the locations too much - they are correct
WSGIScriptAlias / /home/user/django/mysite/wsgi.py
WSGIPythonPath /home/user/django
<Directory /home/user/django/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
I am forced to use a heavily pre-customized version of apache but the conf file above is included. Any help at all would be great.
Cheers, Arthur
Upvotes: 2
Views: 248
Reputation: 3734
Try this wsgi.py:
import os
import sys
os.environ["DJANGO_SETTINGS_MODULE"] = "mysite.settings"
sys.path.append('/home/user/django/mysite/')
sys.path.append('/home/user/django/')
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
And add this to your conf, before the alias:
WSGIDaemonProcess <process_name> processes=2 threads=15 user=<username> display-name=%{GROUP}
WSGIProcessGroup <process_name>
The process name could be "mysite.com" or whatever. The user is a Linux user.
Upvotes: 2