Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Seems complicated. I always use four simple files:

  settings.py
  settings_development.py
  settings_staging.py
  settings_production.py
Where the first one has the defaults (usable for local development), and the others contain any overrides needed to run with Gunicorn on the corresponding dev/staging/production servers.


We have a very similar approach except we encapsulate settings into its own package just for readability/maintainability. So it looks something like the following

    settings/
        __init__.py
        defaults.py
        dev.py
        live.py
        testing.py
        users/
            __init__.py
            *user specific settings*


I wonder what kind of maintainability benefits do the separate packages bring in this case? To me, having a lot of empty __init__.py files and subdirs reduces readability, so I like to maximize simplicity.


I do something very similar. But I just have dummy files in folder depending on the environment (so I do something like 'touch PRODUCTION' or 'touch STAGING') and based off which file is present I know which settings to serve.

Here's a good example (start at line 207): https://github.com/armon/DjangoProjectExample/blob/master/pr...




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: