login community faq

Frustrating problem here... after hours of debugging various problems transitioning my application to webfaction's servers, I'm finally ready to start my server, and... my heart just sank upon seeing "500 SERVER ERROR" in big black font. Checking the logs, the error is:

1
2
3
4
5
6
7
[Thu Aug 11 17:05:46 2011] [error] [client 127.0.0.1] mod_wsgi (pid=2807): Exception occurred processing WSGI script '/home/germanjoey/webapps/django/mysite.wsgi'.
[Thu Aug 11 17:05:46 2011] [error] [client 127.0.0.1] Traceback (most recent call last):
[Thu Aug 11 17:05:46 2011] [error] [client 127.0.0.1]   File "/home/germanjoey/webapps/django/lib/python2.7/django/core/handlers/wsgi.py", line 250, in __call__
[Thu Aug 11 17:05:46 2011] [error] [client 127.0.0.1]     self.load_middleware()
[Thu Aug 11 17:05:46 2011] [error] [client 127.0.0.1]   File "/home/germanjoey/webapps/django/lib/python2.7/django/core/handlers/base.py", line 47, in load_middleware
[Thu Aug 11 17:05:46 2011] [error] [client 127.0.0.1]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Thu Aug 11 17:05:46 2011] [error] [client 127.0.0.1] ImproperlyConfigured: Error importing middleware djangobb_forum.middleware: "No module named djangobb_forum.middleware"

Hmmm, I think... on a hunch, I change the line in settings.py to instead use "mysite.djangobb_forum.middlware", and that gets me a new error:

1
2
3
4
5
6
7
[Thu Aug 11 17:13:12 2011] [error] [client 127.0.0.1] mod_wsgi (pid=4176): Exception occurred processing WSGI script '/home/germanjoey/webapps/django/mysite.wsgi'.
[Thu Aug 11 17:13:12 2011] [error] [client 127.0.0.1] Traceback (most recent call last):
[Thu Aug 11 17:13:12 2011] [error] [client 127.0.0.1]   File "/home/germanjoey/webapps/django/lib/python2.7/django/core/handlers/wsgi.py", line 250, in __call__
[Thu Aug 11 17:13:12 2011] [error] [client 127.0.0.1]     self.load_middleware()
[Thu Aug 11 17:13:12 2011] [error] [client 127.0.0.1]   File "/home/germanjoey/webapps/django/lib/python2.7/django/core/handlers/base.py", line 47, in load_middleware
[Thu Aug 11 17:13:12 2011] [error] [client 127.0.0.1]     raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Thu Aug 11 17:13:12 2011] [error] [client 127.0.0.1] ImproperlyConfigured: Error importing middleware mysite.djangobb_forum.middleware: "No module named djangobb_forum.subscription"

The error of course being that it cannot load a module from within the middleware file it can now find, because it needs to be "mysite.djangobb_forum.subscription" instead of "djangobb_forum.subscription."

This is awful! There's no way I can go and change my hundreds and hundreds of imports around like this! Even if I could, it would break my testing setup on my laptop. Is there way I can set the system path up, or something, so that django can find my modules? I feel like I'm so close here!

This question is marked "community wiki".

asked Aug 11 '11 at 16:30

germanjoey's gravatar image

germanjoey
52


Check you apache config file for WSGIPythonPath directive and make sure all the valid paths are there, editing the strings that define what is a valid path is much easier than changing the code, and this is a common issue when moving from local to deploy as path info will always be different on 2 different OSes and environments.

answered Aug 11 '11 at 18:14

johns's gravatar image

johns ♦♦
345427

Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
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

Tags:

×19
×15
×10
×2

Asked: Aug 11 '11 at 16:30

Seen: 797 times

Last updated: Aug 11 '11 at 18:14

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited