不正确的配置:导入中间件pp.middleware时出错:“没有名为pp.middleware的模块”

时间:2012-02-20 02:04:20

标签: python django

我是django和python的新手,我试图在一段django代码上运行runserver并且遇到以下问题,

Kinnovates-MacBook-Pro:platformsite Kinnovate$ python manage.py runserver
Running in development mode.
Running in development mode.
Running in development mode.
Running in development mode.
Validating models...

0 errors found
Django version 1.4b1, using settings 'platformsite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
    return self.application(environ, start_response)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 219, in __call__
    self.load_middleware()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/handlers/base.py", line 47, in load_middleware
    raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
ImproperlyConfigured: Error importing middleware pp.middleware: "No module named pp.middleware"

我在macOSX10.7上运行python2.7 1.4b Django 我该如何解决这个问题?

1 个答案:

答案 0 :(得分:6)

您在settings.MIDDLEWARE_CLASSES中指定了Django尝试导入的中间件类,但它在您的Python路径中不可用。

您应确保已获得中间件源并且已正确配置Python路径。