繁体   English   中英

Django 将项目从 Windows 主机移动到 Linux 主机(并部署)

[英]Django Move Project from Windows Host to Linux Host (and Deploy)

我正在尝试将我的 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,他也不会通过最后两个安全检查。 并且在调试 State False 中,网站甚至无法在我的 Windows 机器上正确加载...

在此处输入图像描述

即使是 Django 管理面板在这个 state 上看起来也很糟糕......

在此处输入图像描述

如果我尝试在 Linux 服务器上运行run manage.py check --deploy --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).

这是最让我困惑的地方。 I've already adapted the settings.py Static Root and so on AND Django tells me that he is missing the Base_generic.html Template that is definitely there AND Django HAS Access to It. 我完全不明白。

在此处输入图像描述

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

更多信息:

Windows 文件夹和设置.py

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

我发现了我的错误。 那里是绿盒子里的一个空白。 在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM