I created a droplet(cloud server) on DigitalOcean and with no-ip.com I gave it the hostname - project.ddns.net.By ssh(ing) into the droplet I installed pip and virtualenv.
Inside /var/www/ I created a virtualenv and cloned the repository from github of my project.The directory struture is -
project_revamped (root of the project)
->requirements
->base.txt
->dev.txt
->project (django project)
->static
->media
->apps (folder which contains apps)
->manage.py
->project
->urls.py
->settings
->base.py
->dev.py
By following the official Django documentation I created httpd.conf in the /etc/apache2 path and included it in apache2.conf.
My httpd.confs reads as this -
WSGIScriptAlias / /var/www/project_revamped/project/project/wsgi.py
WSGIPythonPath /var/www/project_revamped/project:/var/www/.virtualenvs/projectenv/local/l ib/python2.7/site-packages
<Directory /var/www/project_revamped/project/project>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
and my wsgi.py reads as this -
import os
import sys
#Add the app's directory to the python path
sys.path.append('/var/www/project_revamped/project')
sys.path.append('/var/www/project_revamped/project/project')
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings.dev'
#Activate your virtualenv
activate_env = os.path.expanduser('/var/www/.virtualenvs/typesetenv/bin/activate_this.py')
execfile(activate_env, dict(__file__=activate_env))
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
After changing the files I finally gave the commands - service apache2 reload service apache2 restart
However after doing these things right the corresponding ip says there is some problem the server and sends 500 error.I guess the problem is somewhere in my configuration because apache server was responding working fine.After I include django project with it the problem starts.
After checking the error logs I found these error messages -
mod_wsgi (pid=29458): Target WSGI script '/var/www/project_revamped/project/project/wsgi.py' cannot be loaded as Python module.
mod_wsgi (pid=29458): Exception occurred processing WSGI script '/var/www/project_revamped/project/project/wsgi.py'.
File "/var/www/project_revamped/project/project/wsgi.py", line 28, in <module>
[:error] [pid 29458:tid 140073924572928] [client 103.16.70.147:33613] application = get_wsgi_application()
Can anybody please help me here in the configuration? I am stuck in this for past 2 days and every different article on the internet tells the different story.