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"
ciRails environment, used for running a11y and security scans - Create a "near-production"
stagingRails 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
secure_headersgem and configure CSP header to get OWASP passing by default - Install and configure brakeman for static security scanning
- Install
bundler-auditand set upbundle:auditrake task for Ruby dependency security scans - Set up
yarn:auditrake task for JavaScript dependency security scans - Install Standard Ruby for Ruby linting
- Install rspec for unit testing
- Install dotenv for local configuration
- Setup Rails credential diffing
- Create a separate production credentials file.
- Create a
pre-commithook that can be used to automatically run ruby linter & terraform format - Setup USWDS via postcss
- Setup webpack with
.browserslistrcfrom USWDS - Update
app/views/layouts/application.html.erbto pass thepa11y-ciscan and include the USWDS Banner - Create a
PagesControllerand root route - Create boundary and logical data model compliance diagrams
- Create
manifest.ymland variable files for cloud.gov deployment - Optionally run the
rake db:createandrake db:migratesetup steps - 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)
- Optionally add base translation files and routes for Spanish, French, and Simplified Chinese (es.yml, fr.yml, and zh.yml)
- 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.