How to manage local vs production settings in Django?

前端 未结 22 2050
别跟我提以往
别跟我提以往 2020-11-22 15:00

What is the recommended way of handling settings for local development and the production server? Some of them (like constants, etc) can be changed/accessed in both, but s

22条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 15:06

    I think the best solution is suggested by @T. Stone, but I don't know why just don't use the DEBUG flag in Django. I Write the below code for my website:

    if DEBUG:
        from .local_settings import *
    

    Always the simple solutions are better than complex ones.

提交回复
热议问题