A starter template for Django projects which meets the following requirements:
- Dockerized for ease of startup
- Django Rest Framework installed
- Authentication endpoints set up for DjangoRest Framework
- Pytest installed for testing
- Custom User Model pre-instantiated
- Github Actions Set up for testing
- .ci directory containing a production version of the Dockerfile as well as docker-compose.yaml
This project is heavily inspired by William Vincent's DRFx Repository and guided by his tutorial found here, with a few of my opinions included as well as some niceties that I prefer in my projects:
- Whether it's used or not, it's nice to have pytest installed and set up before getting started
- Similarly, I host exclusively on Github. So a basic github actions workflow is nice
- Docker from the start, simply because it's nice to be able to jump right into a new project without setting up requirements
- pip + requirements.txt for dependency management
There are 2 ways to use the project:
At it's core, this repo contains a greenfield django application with minimal configuration. It defines a custom user model for flexibility later on, and imports django-rest-auth and django-all-auth in order to provide api endpoints for authentication and registration. Alongside that are all the Docker files needed to spin up a new project. A simple docker-compose up -d
should result in the Django hello world page running at http://localhost:8009. To help make the project your own, the ManualRenameToDos.md file contains a list of files and directories that need to be changed in order to make the project completely yours.
If you're constantly spinning up new Django Projects, this library can also be used as a generator for new Django repos. The rename_project.py
script uses the python core library to create and prepare a duplicate of the project in the /app
directory, modified by your input (new project name, directory location, etc). This script uses exclusively the python standard library, so no external packages are needed. Any interpreter 3.6 or higher should be able to run it.