mediacms icon indicating copy to clipboard operation
mediacms copied to clipboard

[Enhancement]Combine settings in single file

Open shubhank-saxena opened this issue 3 years ago • 3 comments

Currently, there are two settings file -

  • cms/local_settings.py used for development
  • cms/settings.py used in production

Since a lot of components are overlapping, we can combine both the files and toggle every setting via any environment file. We can set all the defaults to be used in the development, and an env file (suiting to the needs of the deployer) should be provided for production. This can be achieved using django-environ

shubhank-saxena avatar Apr 09 '21 10:04 shubhank-saxena

+1 for this

I think it's a common practice for a file (cms/settings.py) to be provided by the system, and use a local file (cms/local_settings.py) to override settings. I'm also not too enthusiastic about the fact that the docker-compose installation has an extra settings file (https://github.com/mediacms-io/mediacms/blob/main/deploy/docker/local_settings.py) so it would be great to find a way to unify all files somehow

mgogoulos avatar Apr 27 '21 17:04 mgogoulos

+1 for this

I think it's a common practice for a file (cms/settings.py) to be provided by the system, and use a local file (cms/local_settings.py) to override settings. I'm also not too enthusiastic about the fact that the docker-compose installation has an extra settings file (https://github.com/mediacms-io/mediacms/blob/main/deploy/docker/local_settings.py) so it would be great to find a way to unify all files somehow

Yes. The docker settings can also be combined in the same settings.py file via booleans like 'IN_DOCKER`

shubhank-saxena avatar Apr 27 '21 17:04 shubhank-saxena

-1 for this

Imho it's better to have them separated.

You have the defaults in settings.py. You ignore .local_settings in git with .gitignore. You add the a .local_settings.py-file per machine (like dev, stage, test, prod, docker)

This way you keep the settings file clean and there is a lower risk to expose critical information like mail- or database-credentials in the code-repository.

Creating a pull request for this.

phreaknerd avatar May 04 '21 08:05 phreaknerd