I’m getting this error
Traceback (most recent call last): File '/home/<username>/flup/server/fcgi_base.py', line 558, in run File '/home/<username>/flup/server/fcgi_base.py', line 1116, in handler File '/home/<username>/python/django/django/core/handlers/wsgi.py', line 241, in __call__ response = self.get_response(request) File '/home/<username>/python/django/django/core/handlers/base.py', line 73, in get_response response = middleware_method(request) File '/home/<username>/python/django/django/contrib/sessions/middleware.py', line 10, in process_request engine = import_module(settings.SESSION_ENGINE) File '/home/<username>/python/django/django/utils/importlib.py', line 35, in import_module __import__(name) File '/home/<username>/python/django/django/contrib/sessions/backends/db.py', line 2, in ? from django.contrib.sessions.models import Session File '/home/<username>/python/django/django/contrib/sessions/models.py', line 4, in ? from django.db import models File '/home/<username>/python/django/django/db/__init__.py', line 41, in ? backend = load_backend(settings.DATABASE_ENGINE) File '/home/<username>/python/django/django/db/__init__.py', line 17, in load_backend return import_module('.base', 'django.db.backends.%s' % backend_name) File '/home/<username>/python/django/django/utils/importlib.py', line 35, in import_module __import__(name) File '/home/<username>/python/django/django/db/backends/mysql/base.py', line 13, in ? raise ImproperlyConfigured('Error loading MySQLdb module: %s' % e) ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
when I try to run this script on my shared server
#!/usr/bin/python import sys, os sys.path.insert(0, '/home/<username>/python/django') sys.path.insert(0, '/home/<username>/python/django/www') # projects directory os.chdir('/home/<username>/python/django/www/<project>') os.environ['DJANGO_SETTINGS_MODULE'] = '<project>.settings' from django.core.servers.fastcgi import runfastcgi runfastcgi(method='threaded', daemonize='false')
But, my web host just installed MySQLdb for me a few hours ago. When I run python from the shell I can import MySQLdb just fine. Why would this script report that it can’t find it?
You are missing the python-mysql db driver on your python path. see if you can figure out the pythonpath WSGI is seeing… which can be different from what you are experiencing in shell