Skip to content

gaybro8777/18f-django-project-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

18F Django project template

Django project templates are a little-known option that allows you to create new Django projects based on your own preferences and boilerplate. This means you can pre-install apps, templates and dependencies and have them already in place, predictably and consistently, when you start a new project.

This (currently WIP) project template is designed to make starting a new USWDS-based Django project as simple as possible, while including additional government-related boilerplate such as federated analytics tags.

Starting a new project

  1. Be sure pipenv is installed: pip install pipenv
  2. Create or navigate to the directory you're building your Django project in. Typically, this should be your Git repository.
  3. Grab the pipfile from this repo: wget https://raw.githubusercontent.com/18F/18f-django-project-template/master/Pipfile
  4. Then use it to install Django and other dependencies you'll want for your project: pipenv install
  5. Activate the pipenv shell (virtualenv) with pipenv shell
  6. Now you'll start your project pulling from this repo for the template: django-admin.py startproject --template=https://github.com/18F/18f-django-project-template/archive/master.zip project_name. Be sure to replace project_name with whatever your project should be named.
  7. Move into the project_name directory you just created.
  8. Create a .env for your environment variables. The example.env included here is one good example.
  9. Run python manage.py runserver and go take a look at your new project.

What's next

In development, the project template will create a simple sqlite db. When you prep your staging and prod environments, you'll want to be sure postgresql is ready for you.

Remember to go into your admin and set the site variables, so you don't show up as example.com

By default your AGENCY setting (used for analytics) is set to the project name. Since that's probably not what you want, you'll want to change that.

What's included with the project template

  • Django 2.0+ support
  • base.html based on HTML5 Boilerplate, optimized for USWDS, accessibility and best practices.
  • Uses Pipenv - the officially recommended Python packaging tool from Python.org.
  • Get value insight and debug information while on Development with django-debug-toolbar.
  • HTTPS and other security related settings.
  • Some additional context processors.
  • Cloud.gov integration, including Cloud UAA and database readiness.

Additional docs

Additional documentation is available in the /docs folder.

Upcoming additions

  • USWDS integration (NPM? Submodule? Preferences?)
  • Improved Cloud.gov readiness

Deployment

(Coming) It is possible to deploy to Cloud.gov or to your own server.

License

TBD

Notes

About

WIP: Django project template for 18F

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 52.4%
  • HTML 47.6%