0

我刚刚使用我使用 Django 构建的 Google App Engine 部署了一个网站。但是,每当我尝试实时查看我的网站时,都会收到 500 错误,当我进入 App Engine 仪表板并检查日志时,我会看到以下错误:

"ImproperlyConfigured: Middleware module "autoload.middleware" does 
not define a "AutoloadMiddelware" class"

但这不太有意义,因为我检查了项目中的 autoload 文件夹,里面有一个 middeware.py 文件,它确实定义了一个 AutoloadMiddleware 类,如下所示:

from django.utils.importlib import import_module
from django.conf import settings

# load all models.py to ensure signal handling installation or index loading
# of some apps 
for app in settings.INSTALLED_APPS:
    try:
        import_module('%s.models' % (app))
    except ImportError:
        pass

class AutoloadMiddleware(object):
    """Empty because the import above already does everything for us"""
    pass

可能是导入有问题吗?除了我的项目文件夹中的那些,我的部署是否可能没有上传必要的 django 模块?

4

1 回答 1

0

确保将其添加到您的 settings.py

MIDDLEWARE_CLASSES = (
    # This loads the index definitions, so it has to come first
    'autoload.middleware.AutoloadMiddleware',

    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
)
于 2012-06-06T06:08:48.947 回答