reading-notes

Readings: API Deployment Summary:

Configuring Django Settings: Best Practices:

Managing Django Settings: Issues:

  1. Different environments Each environment can have its own specific settings.we need an approach that allows us to keep all env Django setting configurations.
  2. Sensitive data we have SECRET_KEY in each Django project.. On top of this there can be DB passwords and tokens for third-party APIs like Amazon or Twitter. This data cannot be stored in VCS.
  3. Sharing settings between team members You need a general approach to eliminate human error when working with the settings.
  4. Django settings are a Python code This is a curse and a blessing at the same time. It gives you a lot of flexibility, but can also be a problem – instead of key-value pairs, settings.py can have a very tricky logic.

Setting Configuration: Different Approaches :

  1. First approach » extend all environment-specific settings in settings_local.py file, which is ignored by VCS.
    • Pros: Secrets not in VCS.
    • Cons: * settings_local.py is not in VCS, so you can lose some of your Django environment settings. * The Django settings file is a Python code, so settings_local.py can have some non-obvious logic. * You need to have settings_local.example (in VCS) to share the default configurations for developers.
  2. Second approach » Separate settings file for each environment : This is an extension of the previous approach. It allows you to keep all configurations in VCS and to share default settings between developers.
    • To run a project with a specific configuration, you need to set an additional parameter:
      python manage.py runserver --settings=settings.local
      
    • Pros: * All environments are in VCS. * It’s easy to share settings between developers.

How Does SSH Work :