Friday, November 30, 2018

Re: How to hide the password of postgresql in settings.py

Use this


If you have copied the GitHub template of .gitignore then the .env won't be in your history of vs. I used this in production and development without a single problem.

On Nov 30, 2018 11:54 PM, "Carsten Fuchs" <carsten.fuchs@cafu.de> wrote:
Am 30.11.18 um 18:50 schrieb Sandip Nath:
I am a newbie to Django. Using Postgresql for CRUD operations. Although its working but I need to write the password of my Postgresql server in the settings.py. How can I hide that without hampering the operation?


In your settings.py, you could write something like:


from my_site import localconfig

DEBUG = localconfig.DEBUG
SECRET_KEY = localconfig.SECRET_KEY

# Rest of normal settings.py file
# ...


and in a minmal my_site/localconfig.py file:


DEBUG = True
SECRET_KEY = '...'


For completeness, be aware that some people consider local config files an anti pattern. Personally, I've never found the arguments convincing, but use at your own discretion.

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ddc528e3-12c1-6ba4-0f5b-1be7dad54acd%40cafu.de.
For more options, visit https://groups.google.com/d/optout.

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMMZq8MHS7Jv5-D0nwaFYf5fxrsuj1c7sQ94yv8nZqMJiTFqNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment