Django project not working with Apache and mod-wsgi -
i created droplet(cloud server) on digitalocean , no-ip.com gave hostname - project.ddns.net.by ssh(ing) droplet installed pip , virtualenv.
inside /var/www/ created virtualenv , cloned repository github of project.the directory struture -
project_revamped (root of project) ->requirements ->base.txt ->dev.txt ->project (django project) ->static ->media ->apps (folder contains apps) ->manage.py ->project ->urls.py ->settings ->base.py ->dev.py
i installed apache2 , mod_wsgi using -
sudo apt-get install apache2 sudo apt-get install libapache2-mod-wsgi
i installed mysql,created database , installed requirements
pip install -r base.txt
i created virtualhost project.conf on path -
/etc/apache2/sites-available/project.conf
the content of file -
<virtualhost *:80> serveradmin example@gmail.com servername project.ddns.net servername www.project.ddns.net wsgiscriptalias / /var/www/project_revamped/project/project/wsgi.py <directory /var/www/project_revamped/project/project> order deny,allow allow </directory> </virtualhost>
then gave command activate conf file -
a2ensite project.conf
the content of wsgi.py in django project -
import os import sys import site #add site-packages of chosen virtualenv work site.addsitedir('/var/www/.virtualenvs/projectenv/local/lib/python2.7/site-packages') #add app's directory 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 virtualenv activate_env = os.path.expanduser('/var/www/.virtualenvs/projectenv/bin/activate_this.py' ) execfile(activate_env, dict(__file__=activate_env)) django.core.wsgi import get_wsgi_application application = get_wsgi_application()
after changing files gave commands -
service apache2 reload service apache2 restart
however after doing these things right corresponding ip says there problem server , sends 500 error.i guess problem somewhere in configuration because apache server responding working fine.after include django project problem starts.
can please me here in configuration? stuck in past 2 days , every different article on internet tells different story.
have @ the official documentation. think you're missing wsgipythonpath
-directive.
as @burhankhalid stated, linked tutorial complete , tested , should match setup.
Comments
Post a Comment