Answer the question
In order to leave comments, you need to log in
How to upload a Django project to github with secret information in settings.py?
Hello!
There is a project written in Django. You need to upload it to github. Tell me what should be done with settings.py? After all, there is SECRET_KEY, information about connecting to the database. How to make it so that it's all hidden? And should it be hidden?
Answer the question
In order to leave comments, you need to log in
https://github.com/joke2k/django-environ 1. Create an .env
file on your local machine in the settings folder. Write the
following in it:
DEBUG=on
SECRET_KEY=blablasecret
import environ
env = environ.Env(
DEBUG=(bool, False)
)
environ.Env.read_env()
DEBUG = env('DEBUG')
SECRET_KEY = env('SECRET_KEY')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question