【发布时间】:2014-12-26 22:19:52
【问题描述】:
我有兴趣在我的整个 python django 项目中使用 https。我找到了this 解决方案,它看起来很有希望。我对我的 settings.py 进行了这些更改
SECURE_SSL_REDIRECT = True
SECURE_HSTS_SECONDS = 60
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_FRAME_DENY = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
和
MIDDLEWARE_CLASSES = (
# This middleware is for ensuring that all pages use https
'djangosecure.middleware.SecurityMiddleware',
...
和
INSTALLED_APPS = (
# for https
'djangosecure',
...
当我运行python manage.py checksecure 时,我得到的消息是All clear!,但是,当我部署到谷歌应用引擎时,我得到了这个错误:
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django- 1.5/django/core/handlers/base.py", line 51, in load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
ImproperlyConfigured: Error importing middleware django-secure- 1.0.1.djangosecure.middleware: "No module named django-secure- 1.0.1.djangosecure.middleware"
我做错了什么?
【问题讨论】:
-
我不太喜欢回溯中
django-secure-和1.0.1.djangosecure.middleware之间的间距。 -
对不起,@alecxe,间距不应该在那里。我刚刚复制并粘贴了错误。
标签: python django google-app-engine web https