Skip to content

Commit

Permalink
refactor(script): debug in production friendly scripts setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hUwUtao committed May 26, 2024
1 parent c22fce9 commit 961f394
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,5 @@ pip-selfcheck.json
# End of https://www.toptal.com/developers/gitignore/api/python,virtualenv,node
/media/
/static/
.coverage
.coverage
!scripts
8 changes: 7 additions & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
import sys

if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fuhoblog.settings.dev')
os.environ.setdefault('DJANGO_FORCEPROD', 'False')
os.environ.setdefault(
'DJANGO_SETTINGS_MODULE',
'fuhoblog.settings.dev'
if os.environ['DJANGO_FORCEPROD'] == 'False'
else 'fuhoblog.settings.production',
)

from django.core.management import execute_from_command_line

Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export DJANGO_SETTINGS_MODULE="fuhoblog.settings.production"
source scripts/prod.env
rm -rv static
python manage.py collectstatic
python manage.py migrate --noinput
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions scripts/prod.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DJANGO_SETTINGS_MODULE="fuhoblog.settings.production"
DJANGO_FORCEPROD="True"

0 comments on commit 961f394

Please sign in to comment.