Welcome to the ADMG project repository. This repository contains the code for the ADMG web application, which is a Django web application that provides a user interface for the ADMG database. The application is built using the Django web framework and is designed to be deployed using Docker.
- Project Structure
- Local Development
- Additional Dev Tools
- Automated Deployment
- Configuring system to deploy CASEI
- frontend:
/app/admin_ui - backend:
/app/admg_webapp
- Install docker
- Copy
.env.sample_localto.env - Run docker compose
docker compose up
Run migrations to create the database schema:
docker compose run --rm web sh -c "python manage.py migrate"Create a superuser to access the admin interface:
docker compose run --rm web sh -c "python manage.py createsuperuser"Load a dump of the database to view the application with some data: Download the latest zip file of example data (or get this from one of the database maintainers) & load into the database. The following command will load the data into the database:
cat ./production_dump-2020.01.28.sql | psql admg_webapp^ These commands should be run in a new terminal window, while the application is running.
python manage.py <command>
manage.py is your entry point into the django app. It has several commands, including:
testmigratemakemigrationsrunserver_plusshell_plus- django extensions — third party modules
To run python manage.py commands using docker compose, use the following command structure:
docker compose run --rm -it web python manage.py <command>
Utilize Django's shell for experimentation with queries & other Django functionality:
docker compose run --rm -it web python manage.py shell_plusList all of the URL patterns for the project:
docker compose run --rm it web python manage.py show_urlsRun your tests:
docker compose run --rm -it web pytestRun your tests with coverage:
docker compose run --rm -it web python -m coverage run -m pytestGenerate coverage report:
docker compose run --rm -it web python -m coverage report -m --skip-coveredIf you want to view coverage in your editor using, for example, VSCode's Coverage Gutters plugin, export the coverage report to a supported format:
docker compose run --rm -it web python -m coverage lcov -o coverage.lcovTo build Sass files for the project:
python manage.py sass admin_ui/static/scss admin_ui/static/css --watchSeveral automated workflows are already configured. These can be found within the .github/workflows directory.
The Maintenance Interface is able to initiate a deployment of CASEI. This works by triggering a workflow dispatch event on CASEI's deploy-to-production workflow. To allow the Maintenance Interface to trigger CASEI, a Personal Access Token with actions:write permissions should be provided via the CASEI_GH_TOKEN environment secret. The following environment variables may optionally be provided to override default configuration:
CASEI_GH_REPO, the repo to deploy. Defaults toNASA-IMPACT/admg-inventoryCASEI_GH_WORKFLOW_ID, the workflow to run. Defaults todeploy-to-production.ymlCASEI_GH_BRANCH, the branch to deploy. Defaults toproduction