python - 推荐一个 Django 项目在 Linux 上运行的地方

标签 python django django-settings

我正在将我的第一个 Django 项目上传到 Linux 服务器,我应该将我的项目放在文件系统中吗?

对于 PHP 或 ASP 项目,所有内容都进入 /var/www,是否可以这样做并将我的 Django 项目添加到 /var/www文件夹?

最佳答案

Django tutorial它指出:

Where should this code live?
If your background is in PHP, you're probably used to putting code under the Web server's document root (in a place such as /var/www). With Django, you don't do that. It's not a good idea to put any of this Python code within your Web server's document root, because it risks the possibility that people may be able to view your code over the Web. That's not good for security.

Put your code in some directory outside of the document root, such as /home/mycode.

关于python - 推荐一个 Django 项目在 Linux 上运行的地方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13821959/

相关文章:

python - 将 DF 行乘以系数

python - detectron 2 输出的类标签指的是什么?

python - 模块未定义属性/类

css - Django 在生产中找不到通过 CSS 文件链接的图像

python - Django 日期时间字段 - 在 View 中转换为时区

python - CVXOPT二次编程接口(interface)

django - 为 Python 3.7 virtualenv 安装 mod_wsgi

Django:使用基于类的 View 根据对象的属性进行身份验证

php - 电子商务是否从零开始

python - Django - 为管理错误电子邮件使用不同的电子邮件后端