mediacms-io / mediacms

MediaCMS is a modern, fully featured open source video and media CMS, written in Python/Django and React, featuring a REST API.
https://mediacms.io
GNU Affero General Public License v3.0
2.7k stars 498 forks source link

[Enhancement]Combine settings in single file #145

Closed shubhank-saxena closed 1 year ago

shubhank-saxena commented 3 years ago

Currently, there are two settings file -

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

mgogoulos commented 3 years ago

+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

shubhank-saxena commented 3 years ago

+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`

phreaknerd commented 3 years ago

-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.