Home > database >  Django uploading to Github, any important variables besides secret_key to keep a secret/protect?
Django uploading to Github, any important variables besides secret_key to keep a secret/protect?

Time:09-29

I'm new to Django just started learning it today, since I am quite proficient in express/nodejs and mongodb, I know there are some variables that one should not push to github as they can contain passwords and other identifying information. On express/node I create a .env file and add it to my .gitignore, typically containing the password to my mongodb connection.

I am about to push my first Django api project to github and want to know if there are any other information besides the "SECRET_KEY" that I should protect. Also is .env file still the best way to protect it in Django. Furthermore I have my Django project within a ll_env-virtual environment should it make a difference.

CodePudding user response:

Besides SECRET_KEY there are some other variables like:

  • Database credentials (PASSWORD, etc)
  • If hosted on any cloud providers, their secret keys (AWS_SECRET_KEY)
  • If using Email service, there will be your mail specific password and etc.

In short every variables that you think are to be secured should be stored in a .env file.

Also for the ease of development and production you can store Debug variable.

Basically .env file contains the individual user environment variables when collaborative working. This article by djangocentral may help you know more.

  • Related