【问题标题】:Django Move Project from Windows Host to Linux Host (and Deploy)Django 将项目从 Windows 主机移动到 Linux 主机(并部署)
【发布时间】:2020-03-17 05:40:53
【问题描述】:

我正在尝试将我的 Django 应用程序移动到一个真实的服务器(或将其部署在那里,自托管),但到目前为止,我尝试过的所有内容除了显示错误之外什么都不做。我正在使用 SQLite 数据库,因为该应用根本不会获得太多流量。

例如:如果我尝试在我的 Windows 机器上部署应用程序,我会遇到安全错误,他不会通过。

py -3 manage.py check --deploy
System check identified some issues:

WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS
 carelessly can cause serious, irreversible problems.
?: (security.W008) Your SECURE_SSL_REDIRECT setting is not set to True. Unless your site should be available over both SSL and non-SS
L connections, you may want to either set this setting True or configure a load balancer or reverse-proxy server to redirect all connections to HTTPS.
?: (security.W018) You should not have DEBUG set to True in deployment.

System check identified 3 issues (0 silenced).

即使我将 Debug 设置为 False,他也不会通过最后两个安全检查。并且在调试状态为 False 时,网站甚至无法在我的 Windows 机器上正确加载...

即使是 Django 管理面板在这种状态下看起来也很糟糕......

如果我尝试在 Linux 服务器上运行 run manage.py check --deploy,我会得到完全相同的错误。

python3 Onboarding-Django/onboarding/manage.py check --deploy
System check identified some issues:

WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems.
?: (security.W008) Your SECURE_SSL_REDIRECT setting is not set to True. Unless your site should be available over both SSL and non-SSL connections, you may want to either set this setting True or configure a load balancer or reverse-proxy server to redirect all connections to HTTPS.
?: (security.W018) You should not have DEBUG set to True in deployment.

System check identified 3 issues (0 silenced).

这是最让我困惑的地方。我已经调整了 settings.py Static Root 等等,Django 告诉我他缺少肯定存在的 Base_generic.html 模板,并且 Django 可以访问它。我完全不明白。

请帮助我。我为这个项目工作了一个月,但如果我不能部署它,那么整个事情都是徒劳的......

更多信息:

Windows 文件夹和设置.py

【问题讨论】:

    标签: python django debugging deployment django-deployment


    【解决方案1】:

    我发现了我的错误。 那里是绿盒子里的一个空白。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-11
      • 1970-01-01
      • 2014-08-18
      • 2012-04-23
      • 2012-05-16
      • 1970-01-01
      • 2014-11-02
      • 1970-01-01
      相关资源
      最近更新 更多