This repository was archived by the owner on Nov 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
{{cookiecutter.project_slug}} Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 66 # Loads environment variables from .env file
77 try :
88 import dotenv # noqa
9- dotenv .load_dotenv (os .path .join (os .path .dirname (__file__ ), '.env' ))
10- except ImportError :
9+ dotenv_path = os .path .join (os .path .dirname (__file__ ), '.env' )
10+ assert os .path .isfile (dotenv_path )
11+ dotenv .load_dotenv (dotenv_path )
12+ except (ImportError , AssertionError ):
1113 pass
1214
1315 # Use settings_local.py config first and then default settings
1618 os .path .dirname (__file__ ), '{{cookiecutter.project_slug}}' , 'settings_local.py'
1719 )
1820 assert os .path .isfile (settings_local_path )
19- os .environ .setdefault ('DJANGO_SETTINGS_MODULE' ,
20- '{{cookiecutter.project_slug}}.settings_local' )
21+ settings = '{{cookiecutter.project_slug}}.settings_local'
2122 except AssertionError :
22- os .environ .setdefault ('DJANGO_SETTINGS_MODULE' ,
23- '{{cookiecutter.project_slug}}.settings' )
23+ settings = '{{cookiecutter.project_slug}}.settings'
2424
2525 try :
2626 from django .core .management import execute_from_command_line # noqa
3636 raise
3737
3838 os .environ .setdefault ('PYTHONUNBUFFERED' , '1' )
39+ os .environ .setdefault ('DJANGO_SETTINGS_MODULE' , settings )
40+
3941 execute_from_command_line (sys .argv )
You can’t perform that action at this time.
0 commit comments