WebFaction
Community site: login faq

Dear gurus,

I'm trying to migrate a mod_python app to mod_wsgi. I can't get it to run since it fails to import my urls module, when running under wsgi and also when I run manage.py runserver. It works from the Django shell when I try to "import urls" from there.

These are the first couple and last lines from the exception (if you need more, I can of course provide those):

Traceback (most recent call last): File "/home/nrichter/webapps/django_ws/lib/python2.6/django/core/servers/basehttp.py", line 283, in run self.result = application(self.environ, self.start_response) File "/home/nrichter/webapps/django_ws/lib/python2.6/django/contrib/staticfiles/handlers.py", line 68, in call return self.application(environ, start_response) File "/home/nrichter/webapps/django_ws/lib/python2.6/django/core/handlers/wsgi.py", line 272, in call response = self.get_response(request)

..(stuff omitted)..

File "/home/nrichter/webapps/django_ws/lib/python2.6/django/utils/importlib.py", line 35, in import_module import(name) ImportError: No module named urls

I've looked through all responses here and elsewhere for setting the python path. I've tried the httpd.conf and project.wsgi with all combinations I could think of. When I look at the python path from the Django shell I get this, which seems correct to me:

sys.path ['/home/nrichter/webapps/django_ws/uwe', '/home/nrichter/webapps/django_ws/lib/python2.6', '/home/nrichter/lib/python', '/usr/local/lib/python26.zip', '/usr/local/lib/python2.6', '/usr/local/lib/python2.6/plat-linux2', '/usr/local/lib/python2.6/lib-tk', '/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/site-packages', '/usr/local/lib/python2.6/site-packages/PIL']

This is my project.wsgi. It is being used my mod_wsgi from what I can tell.

import os import sys

from django.core.handlers.wsgi import WSGIHandler

sys.path=['/home/nrichter/webapps','/home/nrichter/webapps/django_ws','/home/nrichter/webapps/django_ws/lib/python2.6'] + sys.path os.environ['DJANGO_SETTINGS_MODULE'] = 'uwe.settings' application = WSGIHandler()

asked 16 Jan '12, 14:34

nrichter
111
accept rate: 0%


Try defining the paths in the Apache configuration, the WSGIPythonPath Directive. You may also submit a support ticket and we will look at the configuration and app directly.

permanent link

answered 16 Jan '12, 17:29

johns
5.4k312
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×62
×56
×8

question asked: 16 Jan '12, 14:34

question was seen: 5,534 times

last updated: 16 Jan '12, 17:29

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM