Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get mod_wsgi and Apache with Django to work

This is the error I get in my Apache error log:

[Sun Aug 22 16:52:06 2010] [error] [client 127.0.0.1] ImportError: No module named settings

This is my .wsgi file, per this blog post:

import sys

sys.path.insert(0, '/home/wot/django-projects/aedo')
import settings
import django.core.management
django.core.management.setup_environ(settings)
utility = django.core.management.ManagementUtility()
command = utility.fetch_command('runserver')
command.validate()
import django.conf
import django.utils

django.utils.translation.activate(django.conf.settings.LANGUAGE_CODE)

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

I've double and triple checked the path name, and that is indeed the path to my project file. I've been trying to get this to work for hours, and have done much googling. I'm asking here as my last resort. I'm desperate!

EDIT: I'm aware that there are similar questions here on SA, and I've read through most all of them, to no avail

like image 493
skroth Avatar asked Aug 23 '10 00:08

skroth


1 Answers

What is the output from running:

ls -las /home/wot/django-projects/aedo/

Is the directory and all the files readable to user that Apache runs as? If they aren't you may get that error.

Also watch talk and look at slides mentioned at:

http://blog.dscpl.com.au/2010/06/sydney-pycon-modwsgi-talk-slides.html

as it discusses permissions issues further.

like image 133
Graham Dumpleton Avatar answered Oct 21 '22 21:10

Graham Dumpleton