Skip to content

Commit

Permalink
feat: add .env file creation in create_dev_env function with existenc…
Browse files Browse the repository at this point in the history
…e check
  • Loading branch information
wilfredinni committed Nov 30, 2024
1 parent 8039220 commit 02dccf6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/django.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from subprocess import check_call
import os


def runserver():
Expand All @@ -14,9 +15,14 @@ def migrate():


def create_dev_env():
if os.path.exists(".env"):
print(".env file already exists. Skipping creation.")
return

with open(".env", "w") as f:
f.write(
"DEBUG=True\n"
"DJANGO_SECRET_KEY=django-insecure-wlgjuo53y49%-4y5(!%ksylle_ud%b=7%__@9hh+@$d%_^y3s!\n" # noqa
"DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres\n"
)
print(".env file created successfully.")

0 comments on commit 02dccf6

Please sign in to comment.