0

Not had any problems implementing this set up before, got a new server set up at home and wanted to work on some django projects.

Im using virtualenv with virtualenvwrapper, mod_wsgi module seems to be installed correctly. here is the vhost im using

<VirtualHost *:80> ServerName local.projectname.com ServerAlias local.projectname.co.uk WSGIDaemonProcess site-dev1 user=mike group=mike threads=20 python-path=/home/mike/envs/projectenv/lib/python2.6/site-packages WSGIProcessGroup site-dev1 WSGIScriptAlias / /home/mike/Sites/path/project/django.wsgi <Directory /home/mike/Sites/path/project> Options +Indexes FollowSymLinks +ExecCGI AllowOverride AuthConfig FileInfo Order allow,deny Allow from all </Directory> # Allow cross domain @font-face styles for Firefox <FilesMatch "\.(ttf|otf|eot)$"> <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" </IfModule> </FilesMatch> ErrorLog /var/log/apache2/error.log LogLevel warn CustomLog /var/log/apache2/access.log combined </VirtualHost> 

When try to navigate to the project i get 500 internal server error, heres the out put from the apache error logs

[Sun Jul 24 08:46:32 2011] [error] [client 127.0.0.1] Traceback (most recent call last): [Sun Jul 24 08:46:32 2011] [error] [client 127.0.0.1] File "/home/mike/Sites/outsideline/queenonline/queenonline.wsgi", line 16, in <module> [Sun Jul 24 08:46:32 2011] [error] [client 127.0.0.1] from django.core.handlers.wsgi import WSGIHandler [Sun Jul 24 08:46:32 2011] [error] [client 127.0.0.1] ImportError: No module named django.core.handlers.wsgi 

I can import from django.core.handlers.wsgi import WSGIHandler in shell with out any errors, As i understand it the process and group of the WSGIdaemon should be the user and group owners of the files, i have also set my apache user and group to run as mike:mike to see if that would work

Im totally out of ideas now so if anyone can shed some light on this i will be eternally grateful!

2
  • Anyone got any ideas " Commented Jul 24, 2011 at 18:08
  • When you have imported Django in the shell, what do you get for 'django.__file__'. This will tell you location of where Django is installed. Commented Jul 24, 2011 at 23:49

1 Answer 1

0

Check the PYTHONPATH

To debug this problem you can output logging output from your .wsgi script to a file using a logger (Python logger). PYTHONPATH can be read inside Python using sys.path

 import sys log = open("/tmp/log.txt", "wt") # ghetto logging print >> log, sys.path # you'll see what you have PYTHONPATH when running the script 

Then you can check if Python can actually open the file

 import sys log = open("/tmp/log.txt", "wt") # ghetto logging try: f = open("/path/to/django/__init__.py", "rt") exception Exception, e: print >> log, str(e) 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.