A Django project boilerplate/template with lots of state of the art libraries and tools like:
- React, for building interactive UIs
- django-js-reverse, for generating URLs on JS
- React Bootstrap, for responsive styling
- Webpack, for bundling static assets
- Celery, for background worker tasks
- WhiteNoise with brotlipy, for efficient static files serving
- prospector and ESLint with pre-commit for automated quality assurance (does not replace proper testing!)
For continuous integration, a Github Action configuration .github/workflows/main.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 and platform errors alerts (must set them manually)
This is a good starting point for modern Python/JavaScript web projects.
- Setup editorconfig, prospector and ESLint in the text editor you will use to develop.
- Inside the
backend
folder, do the following:- Create a copy of
psql_jupyter/settings/local.py.example
:
cp psql_jupyter/settings/local.py.example psql_jupyter/settings/local.py
- Create a copy of
.env.example
:cp .env.example .env
- Create a copy of
- Open the
/backend/.env
file on a text editor and uncomment the lineDATABASE_URL=postgres://psql_jupyter:password@db:5432/psql_jupyter
- Open a new command line window and go to the project's directory
- Run the initial setup:
make docker_setup
- Create the migrations for
users
app:
make docker_makemigrations
- Run the migrations:
make docker_migrate
- Run the project:
make docker_jupyter
- While the project is running, you can also run
make docker_createsuperuser
to create a superuser for your DB - Open the URL that will be displayed on the console
- Inside the Jupyter notebook interface, go to the
notebooks/
dir and click onNew
. In the dropdown, click onDjango Shell-Plus
- You can also toy around with the
test.ipynb
that comes pre-made
- Inside the Jupyter notebook interface, go to the
- To stop the project, run:
make docker_down
- Open a new command line window and go to the project's directory
- Update the dependencies management files by performing any number of the following steps:
- To add a new frontend dependency, run
npm install <package name> --save
The above command will update your
package.json
, but won't make the change effective inside the container yet - To add a new backend dependency, update
requirements.in
ordev-requirements.in
with the newest requirements
- To add a new frontend dependency, run
- After updating the desired file(s), run
make docker_update_dependencies
to update the containers with the new dependenciesThe above command will stop and re-build the containers in order to make the new dependencies effective
- Manually with
prospector
andnpm run lint
on project root. - During development with an editor compatible with prospector and ESLint.
- Run
pre-commit install
to enable the hook into your git repo. The hook will run automatically for each commit. - Run
git commit -m "Your message" -n
to skip the hook if you need.
If you wish to contribute to this project, please first discuss the change you wish to make via an issue.
Check our contributing guide to learn more about our development process and how you can test your changes to the boilerplate.
This project, as other Vinta open-source projects, is used in products of Vinta clients. We are always looking for exciting work, so if you need any commercial support, feel free to get in touch: contact@vinta.com.br
Copyright (c) 2021 Vinta Serviços e Soluções Tecnológicas Ltda.