How do you configure Django for simple development and deployment?

后端 未结 14 1586
闹比i
闹比i 2020-11-30 16:14

I tend to use SQLite when doing Django development, but on a live server something more robust is often needed (MySQL/PostgreSQL, for example). Invariably, there are other c

14条回答
  •  清歌不尽
    2020-11-30 16:51

    I use environment:

    if os.environ.get('WEB_MODE', None) == 'production' :
       from settings_production import *
    else :
       from settings_dev import *
    

    I believe this is a much better approach, because eventually you need special settings for your test environment, and you can easily add it to this condition.

提交回复
热议问题