Skip to content

Instantly share code, notes, and snippets.

@gabrielloliveira
Created November 7, 2021 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielloliveira/64a862b225a9da269fd95bb511507d68 to your computer and use it in GitHub Desktop.
Save gabrielloliveira/64a862b225a9da269fd95bb511507d68 to your computer and use it in GitHub Desktop.
from pathlib import Path
from django.core.management.utils import get_random_secret_key
BASE_DIR = Path(__file__).resolve().parent.parent
ENV_VARIABLES = f"""SECRET_KEY={get_random_secret_key()}
DEBUG=True
ALLOWED_HOSTS=*
"""
file = open(f"{BASE_DIR}/meuprojeto/.env", "w")
file.write(ENV_VARIABLES)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment