Skip to content

Commit

Permalink
chore: replace manage.py with benefits cli
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman committed Oct 31, 2024
1 parent 957cd5c commit cdb33c1
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 46 deletions.
16 changes: 14 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
}
}
]
}
1 change: 0 additions & 1 deletion appcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions bin/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion bin/makemessages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion bin/makemigrations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -eux

# generate

python manage.py makemigrations
benefits makemigrations

# reformat with black

Expand Down
4 changes: 2 additions & 2 deletions bin/reset_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions docs/configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down
26 changes: 13 additions & 13 deletions docs/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<SITE KEY HERE>",
"DJANGO_RECAPTCHA_SECRET_KEY": "<SECRET KEY HERE>"
}
"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": "<SITE KEY HERE>",
"DJANGO_RECAPTCHA_SECRET_KEY": "<SECRET KEY HERE>"
}
}
```

Expand Down
21 changes: 0 additions & 21 deletions manage.py

This file was deleted.

0 comments on commit cdb33c1

Please sign in to comment.