简体   繁体   中英

How to make a django package modify settings.py?

I'm trying to set up a django application, which itself has a few dependencies. One of these ( crispy forms ) requires a few settings to be set in settings.py before the application will work. I know what defaults I want to use. How can I make my app modify the default settings on the fly? Specifically:

  1. How do I ensure that whatever custom settings file I create is recognized as a settings file by django?
  2. How do I actually modify the settings?

For (2) above it looks like this link on Django Code may work, but it doesn't explain how to go about (1). Thanks in advance!

您可以在主settings.py中添加crispy form设置,但是如果您希望将依赖项设置应用程序与设置分离,则必须创建crispy_settings.py文件并将其导入您的设置文件中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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