简体   繁体   English

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

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

I'm trying to Move my Django App to a real Server (or deploy it there, self-hosted) but everything, I have tried so far, does nothing except displaying errors.我正在尝试将我的 Django 应用程序移动到真正的服务器(或将其部署在那里,自托管),但到目前为止,我尝试过的所有内容除了显示错误之外什么都不做。 I'm using the SQLite database because the app won't get much traffic at all.我正在使用 SQLite 数据库,因为该应用程序根本不会获得太多流量。

For Example: If I try to deploy the app on my Windows machine I get security errors he won't pass.例如:如果我尝试在我的 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).

Even if I set Debug to False he won't pass the last two Security Checks.即使我将 Debug 设置为 False,他也不会通过最后两个安全检查。 AND in Debug State False the Website even does not load correctly on my Windows machine...并且在调试 State False 中,网站甚至无法在我的 Windows 机器上正确加载...

在此处输入图像描述

Even the Django Admin Panel looks awful at this state...即使是 Django 管理面板在这个 state 上看起来也很糟糕......

在此处输入图像描述

If I try to run run manage.py check --deploy on the Linux server I get the exact same errors.如果我尝试在 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).

And here is what confuses me the most.这是最让我困惑的地方。 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. 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. I don't get it at all.我完全不明白。

在此处输入图像描述

Please help me.请帮我。 I worked month for this Project but if I can't deploy it the whole thing was for nothing...我为这个项目工作了一个月,但如果我不能部署它,那么整个事情都是徒劳的......

More Information:更多信息:

Windows Folders and settings.py Windows 文件夹和设置.py

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

I found my Error.我发现了我的错误。 There where a blank in the Green Box.那里是绿盒子里的一个空白。 在此处输入图像描述

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

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