Thanks Carsten, It's also a great method.
What do u mean by on installation @On installation, the file is then copied to localconfig.py, where it is *ignored* by svn, git, etc. The file is then customized for production, development, …
Do u mean during deployment?
On Wed, Mar 2, 2022 at 7:49 AM Carsten Fuchs <carsten.fuchs@cafu.de> wrote:
Am 02.03.22 um 04:23 schrieb Mike Dewhirst:
> ... where you write get_secret_key() to pull it from the environment or a file somewhere which is not in your repository.
A variant of this that I like is to have a file like localconfig.example in the repository next to settings.py that contains e.g.
DATABASES = ... # dummy or default config
SECRET_KEY = 'example'
On installation, the file is then copied to localconfig.py, where it is *ignored* by svn, git, etc. The file is then customized for production, development, …
In settings.py, there is
from project_dir import localconfig
# ...
DEBUG = localconfig.DEBUG
SECRET_KEY = localconfig.SECRET_KEY
DATABASES = localconfig.DATABASES
# ...
This works very well and is simple, safe and convenient.
Best regards,
Carsten
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/27159e6a-0472-97c5-8816-7c5a46a3eb89%40cafu.de.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEO1GrqUrHfxBL_J1cGHDjjVdbbfciBTpc322%3DZZFOMckcx-qw%40mail.gmail.com.
No comments:
Post a Comment