[英]How can i make a file with constants in django3.0.2 python3.6 and access it in all applications . Any github repository is also useful
include(
# the project different envs settings
optional('envs/devel/*.py'),
optional('envs/production/*.py'),
optional('envs/staging/*.py'),
# for any local settings
optional('local_settings.py'),
optional('path.py'),
)
What should be the folder structure I follow to build Django web application, I did not found any repo on github in which contains files that are made according to the environments.我构建 Django web 应用程序时应该遵循的文件夹结构是什么,我在 github 上没有找到任何包含根据环境制作的文件的 repo。 As i am moving from php to python i did not found how to exactly define the constants in python so that the value of the constants will not change anywhere.
当我从 php 转移到 python 时,我没有找到如何在 python 中准确定义常量,以便常量的值不会在任何地方改变。
print("currently i am using django-split-settings to include files")
when using django you do not do this.使用 django 时不要这样做。 rather in the settings.py file.
而是在 settings.py 文件中。 you check whether the debug flag is true or false ie whether the project is in production or not.
你检查调试标志是真还是假,即项目是否在生产中。 to change the settings for development/deployment.
更改开发/部署设置。
when you host it on github any thing is fine as long as you add a requirements.txt to allow you to install the requirements on another machine.当您在 github 上托管它时,只要您添加一个 requirements.txt 以允许您在另一台机器上安装需求,任何事情都可以。 its a good rule of thumb to not use virtualenvs on different machines so it is rare to see them on github repos.
在不同的机器上不使用 virtualenvs 是一个很好的经验法则,所以很少在 github repos 上看到它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.