-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added the a scripts help generate secret key #34
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for digging into this! One thought and question ⚡
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = os.getenv("DEBUG") | ||
|
||
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '').split(',') | ||
ALLOWED_HOSTS = ["*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the motivation for moving this into here, instead of keeping it in .env
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is easy to access rather than keeping it in .env file and other will know it part of the setting as we don't push .env to GitHub @joshaber
@@ -1,8 +1,7 @@ | |||
SECRET_KEY=my_secret_key | |||
SECRET_KEY= replace with your secret key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about generating the secret as part of the postCreateCommand
, so that devs don't have to manually do anything? The script is definitely an improvement, but ideally folks wouldn't have to know/care about generating the secret.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i taught of doing this but i feel incase of doing a cloud uploading must time people need to document or change their secret keys reason i added it as script @joshaber
This pull request involves changes to improve the configuration and security of a Django project. The most significant changes include the introduction of a script to generate a secret key, changes to the
ALLOWED_HOSTS
andSECRET_KEY
settings inhello_world/settings.py
, and updates to theREADME.md
and.env.example
files.Security improvements:
secretgen.py
: A new Python script was added to generate a random secret key for Django projects. This script uses Django'sget_random_secret_key
function to generate the key and instructs the user to replace the secret key in their.env
file with the generated key.Documentation updates:
README.md
: Instructions were added on how to generate a secret key for a Django project using the newsecretgen.py
script.