通过HTTPS提供安全的Django页面 [英] Serving secure Django pages with HTTPS
问题描述
需要使用HTTPS服务的某些页面的Django应用程序的正确部署配置是什么?
我想使用HTTPS进行涉及注册和输入密码的页面。我想对所有其他页面使用HTTP。
What is the proper deployment configuration for a Django application that needs some pages served with HTTPS and others with HTTP? I want to use HTTPS for the pages that involve registration and inputting passwords. I want to use HTTP for all other pages.
推荐答案
据我所知,没有一种方法。您可以使用Scott Barnham发表的这篇文章中开发的装饰器 secure_required
:
There's no single approach as far as I know. You can use a decorator secure_required
as developed in this post by Scott Barnham:
- Securing Django with SSL
或使用中间件:
- SSLMidleware
如果您正在查找关于Apache和mod_wsgi的部署信息,那么Graham Dumpleton在此问题中提供了一个很好的答案:
If you're looking for deployment information with respect to Apache and mod_wsgi, then Graham Dumpleton provides a nice answer in this question:
- How to force the use of SSL for some URL of my Django Application ?
这篇关于通过HTTPS提供安全的Django页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!