A Django 1.10 project boilerplate/template with lots of state of the art libraries and tools like:
- React, for interactive UI development
- django.js, for generating URLs on JS
- Bootstrap 4, for responsive styling
- Webpack, for bundling static assets
- Celery, for background worker tasks
- WhiteNoise with brotlipy, for efficient static files serving
For continuous integration, a CircleCI configuration circle.yml
is included.
Also, includes a Heroku app.json
and a working Django production.py
settings, enabling easy deployments with 'Deploy to Heroku' button. Those Heroku plugins are included in app.json
:
- PostgreSQL, for DB
- Redis, for Celery
- Sendgrid, for e-mail sending
- Papertrail, for logs
- Opbeat, for performance monitoring
This should be enough as a starting point for any modern web project.
- Start your project using:
django-admin startproject theprojectname --extension py,yml,json --name Procfile --template=https://github.com/vintasoftware/boilerplate/archive/master.zip
- Above: don't forget the
--extension
and--name
params! -
pip install -r requirements-to-freeze.txt
-
pip freeze > requirements.txt
-
npm update --save
- Check for outdated npm dependencies with
npm outdated
and update them - Change the first line of README to the name of the project
- Create a Google Group to receive 500 errors and forward to your email. It should be a private group, but remember to change settings to allow posting from any email
- Add the Google Group email address to the
ADMINS
settings variable
After completing ALL of the above, remove this Project bootstrap
section from the project README.
If you made changes to this boilerplate and want to test them, commit your changes and use git archive -o boilerplate.zip HEAD
to create the template zip.
Push your changes to a branch and visit https://dashboard.heroku.com/new?template=https://github.com/fill-org-or-user/fill-project-repo-name/tree/fill-branch
(replace all fill
).
Read this.
- Create a copy of
{{project_name}}/settings/local.py.example
in{{project_name}}/settings/local.py
- Create a
.env
file in the root of the project and addDJANGO_SETTINGS_MODULE="{{project_name}}.settings.local"
to it - Create the migrations for
users
app:python manage.py makemigrations
- Run the migrations:
python manage.py migrate
- Setup editorconfig, flake8 and ESLint in the text editor you will use to develop.
pip install -r requirements.txt
npm install
make bundle
python manage.py runserver
make test
Will run django tests using --keepdb
and --parallel
. You may pass a path to the desired test module in the make command. E.g.:
make test someapp.tests.test_views
Add high level dependecies to requirements-to-freeze.txt
and pip freeze > requirements.txt
. This is A Better Pip Workflow.
- Manually with
flake8
andnpm run lint
on project root. - During development with an editor compatible with flake8 and ESLint.