Django将项目从Windows主机移至Linux主机(和部署)

我正在尝试将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将项目从Windows主机移至Linux主机(和部署)

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

Django将项目从Windows主机移至Linux主机(和部署)

如果我尝试在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静态根,等等,并且Django告诉我他缺少肯定存在的Base_generic.html模板,并且Django可以访问它。我一点都不明白。

Django将项目从Windows主机移至Linux主机(和部署)

请帮助我。我为这个项目工作了一个月,但如果我不能部署它,那么整个事情就白费了……

更多信息:

Windows文件夹和settings.py

Django将项目从Windows主机移至Linux主机(和部署)

Django将项目从Windows主机移至Linux主机(和部署)

Django将项目从Windows主机移至Linux主机(和部署)

poilkjm 回答:Django将项目从Windows主机移至Linux主机(和部署)

我发现了我的错误。 那里的绿色框中有空白。 enter image description here

本文链接:https://www.f2er.com/3059121.html

大家都在问