4

Content of example.wsgi file in /var/www

import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('~/.virtualenvs/menv/local/lib/python2.7/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/var/www/example')
sys.path.append('/var/www/example/example')
os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings'
# Activate your virtual env
activate_env=os.path.expanduser("~/.virtualenvs/menv/bin/activate_this.py")
execfile(activate_env, dict(__file__=activate_env))
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Content of example.conf

<VirtualHost *:80>
ServerAdmin webmaster@mydomain.com
ServerName example.redirectme.net
ServerAlias www.example.redirectme.net
WSGIScriptAlias / /var/www/example.wsgi
<Directory /var/www/polls>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

polls is the name of the app inside example project

Ajeet Khan
  • 8,582
  • 8
  • 42
  • 65
  • I think the problem is with wsgi file. When I edit wsgi file and try to produce some error and after restarting server. There were no error related to wsgi file. – Ajeet Khan Apr 17 '15 at 16:47
  • Which django version? Which wsgi? Which Python? Is wsgi compiled for the same Python version? Where is the error? Is it a 500? Any error logs from apache? – Wtower Apr 24 '15 at 12:42

2 Answers2

0

If polls is the name of the app within the example project, your example.conf file should probably have this line:

<Directory /var/www/example/polls>

instead of this one:

<Directory /var/www/polls>
Dan Russell
  • 960
  • 8
  • 22
0

Thanx for trying to help. I have sort out the issue. Everything was correct. The conf file that i have created was not enabled. So I ran the following command.

a2ensite example.conf
Ajeet Khan
  • 8,582
  • 8
  • 42
  • 65