An opinionated template repository for building REST APIs with Django Rest Framework.
- Get started by cloning the repo.
- Use uv to install the dependencies by running
uv sync. - Create a
.envfile copying.env.exampleand fill out the values you need. - Initialize the git repository (if needed) by running
git init - Install the pre-commit hooks by running
uv run pre-commit install - Find all
TODOcomments to see what needs to be updated
- The python version set in
.python-version. Update to whatever you want. - The main configuration is in the
apifolder. Settings are set per environment. Names are self-explanatory. - Expects a postgres database outside of unit testing.
- DRF is setup to use a custom standardized error response that is useful for 400 validation errors.
- It is expected to use synchronous python and gunicorn + gevent workers at deployment.
- There is a custom user model based on
AbstractUserfrom django. - Testing uses
pytestinstead ofunittest. - If you want to run things locally, run
make run-infraand thenmake run-server. - It is setup for simple Railway deployment but easily adaptable to any cloud provider really.
- Common commands are in the Makefile. Use them.