Import error with wsgi and Django

147 views
Skip to first unread message

Jer

unread,
Feb 8, 2010, 11:00:47 AM2/8/10
to modwsgi
Hello,
I just recently put modwsgi on both my personal and production
servers, both servers are running Fedora Core 7 w/Apache2.

I have the same basic setup between the two servers, however I'm
running into an odd issue with the production server and modwsgi. I
get the following error in the apache logs when trying to hit the
site:

[Mon Feb 08 10:40:30 2010] [error] [client 208.247.xx.xxx] mod_wsgi
(pid=24538): Exception occurred processing WSGI script '/
django_projects/srm/django.wsgi'., referer: http://mysite.com/standards/
[Mon Feb 08 10:40:30 2010] [error] [client 208.247.xx.xxx] Traceback
(most recent call last):, referer: http://mysite.com/standards/
[Mon Feb 08 10:40:30 2010] [error] [client 208.247.xx.xxx] File "/
usr/local/lib/python2.5/site-packages/django/core/handlers/wsgi.py",
line 230, in __call__, referer: http://mysite.com/standards/
[Mon Feb 08 10:40:30 2010] [error] [client 208.247.xx.xxx]
self.load_middleware(), referer: http://mysite.com/standards/
[Mon Feb 08 10:40:30 2010] [error] [client 208.247.xx.xxx] File "/
usr/local/lib/python2.5/site-packages/django/core/handlers/base.py",
line 42, in load_middleware, referer: http://mysite.com/standards/
[Mon Feb 08 10:40:30 2010] [error] [client 208.247.xx.xxx] raise
exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"'
% (mw_module, e), referer: http://mysite.com/standards/
[Mon Feb 08 10:40:30 2010] [error] [client 208.247.xx.xxx]
ImproperlyConfigured: Error importing middleware
django.contrib.flatpages.middleware: "No module named mysql.base",
referer: http://mysite.com/standards/


If I uncomment LoadModule python_module modules/mod_python.so then I
don't get the error and the site loads.

Here is the apache config:

#LoadModule python_module modules/mod_python.so
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
LoadModule wsgi_module modules/mod_wsgi.so


<VirtualHost *>
ServerName mysite.com
WSGIScriptAlias / /django_projects/thesite/django.wsgi
</VirtualHost>
<Directory /django_projects/thesite/>
Order deny,allow
Allow from all
</Directory>

and my django.wgsi file:

import os
import sys
os.environ['PYTHON_EGG_CACHE'] = '/python-egg-cache'
os.environ['DJANGO_SETTINGS_MODULE'] = 'thesite.settings'

sys.path.append('/django_projects')
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()


Any help would be appreciated. If you need information/I left anything
out, please let me know.

Thanks,
Jer

Graham Dumpleton

unread,
Feb 9, 2010, 12:16:17 AM2/9/10
to mod...@googlegroups.com
Likely that your mod_python was compiled against a different Python
version for which mysql wasn't installed, or it used a static Python
library and not a shared library. Such mismatches can causes crashes,
strange behaviour or outright failure. Have a read about this conflict
between mod_python and mod_wsgi in:

http://code.google.com/p/modwsgi/wiki/InstallationIssues

Graham

> --
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages