diff --git a/.vscode/launch.json b/.vscode/launch.json index 097ef515f4..fdebcd5873 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "Django: Benefits Client", "type": "python", "request": "launch", - "program": "${workspaceFolder}/manage.py", + "program": "${workspaceFolder}/benefits/cli/main.py", "args": ["runserver", "--insecure", "0.0.0.0:8000"], "django": true, "env": { @@ -20,13 +20,25 @@ "name": "Django: Benefits Client, Debug=False", "type": "python", "request": "launch", - "program": "${workspaceFolder}/manage.py", + "program": "${workspaceFolder}/benefits/cli/main.py", "args": ["runserver", "--insecure", "0.0.0.0:8000"], "django": true, "env": { "DJANGO_DEBUG": "false", "DJANGO_STATICFILES_STORAGE": "django.contrib.staticfiles.storage.StaticFilesStorage" } + }, + { + "name": "Benefits CLI", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/benefits/cli/main.py", + "args": [], + "django": true, + "env": { + "DJANGO_DEBUG": "true", + "PYTHONWARNINGS": "default" + } } ] } diff --git a/appcontainer/Dockerfile b/appcontainer/Dockerfile index d641150c16..18b24f3eb9 100644 --- a/appcontainer/Dockerfile +++ b/appcontainer/Dockerfile @@ -29,7 +29,6 @@ COPY appcontainer/proxy.conf /calitp/run/proxy.conf # copy runtime files COPY --from=build_wheel /build/dist /build/dist -COPY manage.py manage.py COPY bin bin COPY benefits benefits diff --git a/bin/init.sh b/bin/init.sh index c2a283c2a5..203fdb8f8f 100755 --- a/bin/init.sh +++ b/bin/init.sh @@ -3,12 +3,12 @@ set -eux # run database migrations -python manage.py migrate +benefits migrate # generate language *.mo files for use by Django -python manage.py compilemessages +benefits compilemessages # collect static files -python manage.py collectstatic --no-input +benefits collectstatic --no-input diff --git a/bin/makemessages.sh b/bin/makemessages.sh index 48217e533c..fb6a821a56 100755 --- a/bin/makemessages.sh +++ b/bin/makemessages.sh @@ -3,7 +3,7 @@ set -eu # generate initial .PO files from msgids in template and view files -python manage.py makemessages -a --no-obsolete --no-location +benefits makemessages -a --no-obsolete --no-location # put back bug-report link diff --git a/bin/makemigrations.sh b/bin/makemigrations.sh index 89d755f0be..9f04fe087c 100755 --- a/bin/makemigrations.sh +++ b/bin/makemigrations.sh @@ -3,7 +3,7 @@ set -eux # generate -python manage.py makemigrations +benefits makemigrations # reformat with black diff --git a/bin/reset_db.sh b/bin/reset_db.sh index e2e3d76d9b..339ee15918 100755 --- a/bin/reset_db.sh +++ b/bin/reset_db.sh @@ -18,7 +18,7 @@ if [[ $DB_RESET = true ]]; then # create a superuser account for backend admin access # set username, email, and password using environment variables # DJANGO_SUPERUSER_USERNAME, DJANGO_SUPERUSER_EMAIL, and DJANGO_SUPERUSER_PASSWORD - python manage.py createsuperuser --no-input + benefits createsuperuser --no-input else echo "DB_RESET is false, skipping" fi @@ -27,7 +27,7 @@ valid_fixtures=$(echo "$DJANGO_DB_FIXTURES" | grep -e fixtures\.json$ || test $? if [[ -n "$valid_fixtures" ]]; then # load data fixtures - python manage.py loaddata "$DJANGO_DB_FIXTURES" + benefits loaddata "$DJANGO_DB_FIXTURES" else echo "No JSON fixtures to load" fi diff --git a/docs/configuration/README.md b/docs/configuration/README.md index a3a06b17b2..f41b095d44 100644 --- a/docs/configuration/README.md +++ b/docs/configuration/README.md @@ -35,7 +35,7 @@ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") ``` -Elsewhere, e.g. in [`manage.py`][benefits-manage], this same environment variable is set to ensure `benefits.settings` +Elsewhere, e.g. in [`cli`][benefits-cli] app, this same environment variable is set to ensure `benefits.settings` are loaded for every app command and run. ## Using configuration in app code @@ -74,7 +74,7 @@ else: # do something when this agency is inactive ``` -[benefits-manage]: https://github.com/cal-itp/benefits/blob/main/manage.py +[benefits-cli]: https://github.com/cal-itp/benefits/blob/main/benefits/cli/main.py [benefits-settings]: https://github.com/cal-itp/benefits/blob/main/benefits/settings.py [benefits-wsgi]: https://github.com/cal-itp/benefits/blob/main/benefits/wsgi.py [django-model]: https://docs.djangoproject.com/en/5.0/topics/db/models/ diff --git a/docs/development/README.md b/docs/development/README.md index 732892ace7..0417693f12 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -51,19 +51,19 @@ The [environment](../configuration/environment-variables.md) can also be overrid ```jsonc { - "name": "Django: Benefits Client", - "type": "python", - "request": "launch", - "program": "${workspaceFolder}/manage.py", - "args": ["runserver", "--insecure", "0.0.0.0:8000"], - "django": true, - "env": { - // existing field... - "DJANGO_DEBUG": "true", - // add these 2 entries with the values for reCAPTCHA - "DJANGO_RECAPTCHA_SITE_KEY": "", - "DJANGO_RECAPTCHA_SECRET_KEY": "" - } + "name": "Django: Benefits Client", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/benefits/cli/main.py", + "args": ["runserver", "--insecure", "0.0.0.0:8000"], + "django": true, + "env": { + // existing field... + "DJANGO_DEBUG": "true", + // add these 2 entries with the values for reCAPTCHA + "DJANGO_RECAPTCHA_SITE_KEY": "", + "DJANGO_RECAPTCHA_SECRET_KEY": "" + } } ``` diff --git a/manage.py b/manage.py deleted file mode 100644 index b291df6447..0000000000 --- a/manage.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -"""Django's command-line utility for administrative tasks.""" -import os -import sys - - -def main(): - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") - try: - from django.core.management import execute_from_command_line - except ImportError as exc: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) from exc - execute_from_command_line(sys.argv) - - -if __name__ == "__main__": - main()