简体   繁体   English

如何在 django3.0.2 python3.6 中创建一个带有常量的文件并在所有应用程序中访问它。 任何 github 存储库也很有用

[英]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.更改开发/部署设置。

hosting on github在 github 上托管

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.

相关问题 我该如何抓取所有 <td> 内容是什么?(python3.6) - How can I crawl all the <td> contents?(python3.6) 如何让 venv 安装 python3.6 二进制文件? - How can I make venv install a python3.6 binary? 如何在 python3.6 中将任何随机字节字符串转换为可播放的 mp3 文件? - How can I convert any random byte string to a playable mp3 file in python3.6? 重新启动/注销/登录后,如何使Python3.6 Red Hat Software Collection持久存在? - How can I make Python3.6, Red Hat Software Collection, persist after a reboot/logout/login? 如何存储从Excel到python3.6的列? - How can I store columns from excel to python3.6? 如何在Python3.6中处理“ UnboundLocalError”? - How can I handle “UnboundLocalError” in Python3.6? 如何在Python3.6和CentOs上安装Twisted + Scrapy - How Can I install Twisted + Scrapy on Python3.6 and CentOs 我可以pip安装python3.6吗? - Can I pip install python3.6? 我如何使用python3.6从文件中提取单词的一部分? - How I can extract the portion of words from the file using python3.6? 如何确保在对列表进行混排之后,所有值实际上都已更改索引? (Python3.6) - How do I make sure that after shuffling a list, all values have actually changed index? (Python3.6)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM