Created
June 21, 2018 15:51
-
-
Save dubirajara/6d6d922b4ed1adb6021511c26b651954 to your computer and use it in GitHub Desktop.
Generate .env config file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.management import utils | |
CONFIG_ENV = f""" | |
SECRET_KEY={utils.get_random_secret_key()} | |
DEBUG=True | |
ALLOWED_HOSTS=* | |
DEFAULT_FROM_EMAIL=admin@exemple.com | |
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend | |
EMAIL_HOST=localhost | |
EMAIL_HOST_USER= | |
EMAIL_HOST_PASSWORD= | |
EMAIL_PORT=25 | |
EMAIL_USE_TLS=False | |
""" | |
# Writing our configuration file to '.env' | |
with open('myproject/.env', 'w') as configfile: | |
configfile.write(CONFIG_ENV) | |
print('Created the .env file successfully.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment