Convenience Scripts¶
These are designed to make it easier to perform various everyday tasks in the project. They try to be transparent by exposing the underlying commands they execute so that users can have an idea of what's happening and try to learn the commands if they wish.
scripts/
├── buildrun.sh
├── check-migrations.sh
├── createsuperuser.sh
├── db.sh
├── erd.sh
├── lint.sh
├── loadenv.sh
├── logs.sh
├── migrate.sh
├── precommit-check.sh
├── run.sh
├── start-local.sh
├── test.sh
└── update-dependencies.sh
These scripts assume you are using bash.
-
buildrun.sh - clean, build, and run containers in background mode
- Pass in
-vto remove data volume, which resets the local database. - See the script file for more options.
- Pass in
-
check-migrations.sh - check if migrations are up to date
-
createsuperuser.sh - create a default superuser
- This assumes that
DJANGO_SUPERUSER_USERNAMEandDJANGO_SUPERUSER_PASSWORDare set in.env.dev
- This assumes that
-
db.sh - connect to the database in the
dbcontainer- This is a different route than
manage.py dbshell, which requires thepsqlexecutable in thewebcontainer
- This is a different route than
-
erd.sh - generate ER diagram
- The image is saved to
app/erd.png - This script is dependent on the
graphvizpackage
- The image is saved to
-
lint.sh - lint and and auto-format code
-
loadenv.sh - load environment variables from
.env.devinto shell environment -
logs.sh - view/tail container logs
-
migrate.sh - run database migrations inside container
- Add
<app> <migration_number>to migrate to that database state. Ex:migrate.sh core 0010
- Add
-
precommit-check.sh - sanity checks before committing code
- Call
buildrun.sh,lint.sh, andtest.sh
- Call
-
run.sh - start the development server in Docker, with some options
- Pass in
-hto show usage
- Pass in
-
start-local.sh - start the development server natively
-
test.sh - run tests and generate test coverage report
- Use the
-kflag to filter tests. For exampletest.sh -k program_areawill select only tests with "program_area" in the name. - Pass in
--no-covto disable the coverage report. The coverage report will show many missing lines of coverage as a result.
- Use the
-
update-dependencies.sh - update python dependencies to the latest versions