This script will create a new Django project using various defaults for US government websites.
- Run
pipenv install - Run
pipenv run python 18f_django_template.py
If any of these options are not provided on the command line, then you will be prompted for them interactively.
-
--app-name=<new-application-name>: This is used as the name of the new application's directory and a Python identifier is derived from it and used as the name of the new Django app inside that directory. -
--uswds/--no-uswds: For application's that don't have an HTML frontend, you can specify--no-uswdsto not install the US Web Design System (USWDS). If you do choose to install USWDS, then you will need to have Node.js/npm installed locally for the installation. -
--circleci/--no-circleci: Configure continuous integration with the CircleCI service (or not). The resulting project will have a.circleci/config.ymlfile. -
--github-actions/--no-github-actions: Configure continuous integration with Github Actions. The resulting project will have.github/actionsand.github/workflowsdirectories.
- Create a better default
README - Copy
CONTRIBUTING.mdandLICENSE.mdfrom the 18F Open Source Policy repo - Create a "near-production"
cidjango environment, used for running a11y and security scans - Create a "near-production"
stagingdjango environment, used for cloud.gov staging environment, with a "TEST SITE" warning banner - Create a
.nvmrcfile for specifying the NodeJS version in use - Set up
pa11y-cifor a11y scanning - Set up
OWASP ZAPdynamic security scanning - Include
django-csppackage and configure CSP header to get OWASP passing by default - Install and configure bandit for static security scanning
- Install
bundler-auditand set upbundle:auditrake task for Ruby dependency security scans - Install flake8 for python linting
- Install black for python formatting
- Install django-webtest for unit testing
- Install coverage.py for coverage reporting
- Create a separate production credentials file.
- Create a
pre-commithook that can be used to automatically run black, flake8 and bandit - Setup USWDS via postcss
- Update
templates/base.htmlinclude the USWDS Banner - Create boundary and logical data model compliance diagrams
- Create
manifest.ymland variable files for cloud.gov deployment - Optionally create Github Actions workflows for testing and cloud.gov deploy
- Optionally create terraform modules supporting staging & production cloud.gov spaces
- Optionally create CircleCI workflows for testing and cloud.gov deploy
- Optionally create a New Relic config with FEDRAMP-specific host
- Optionally configure DAP (Digital Analytics Program)
- Create Architecture Decision Records for above setup
- Commit the resulting project with git (unless
--skip-gitis passed)
To run the test suite, run pipenv install --dev and then pipenv run pytest
from this repository directory. Make sure you have npm and docker
installed as some tests require them.
Bug reports and pull requests are welcome on GitHub at https://github.com/18f/django-template. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
Everyone interacting in the 18F Django Template project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.