Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wilfredinni/django-starter-template
Django 5+, Django Rest Framework, Redis/Celery and more
https://github.com/wilfredinni/django-starter-template
boilerplate django django-rest-framework djangorestframework python template
Last synced: 3 months ago
JSON representation
Django 5+, Django Rest Framework, Redis/Celery and more
- Host: GitHub
- URL: https://github.com/wilfredinni/django-starter-template
- Owner: wilfredinni
- License: mit
- Created: 2022-03-07T23:02:17.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-25T23:15:36.000Z (3 months ago)
- Last Synced: 2024-10-26T10:36:52.167Z (3 months ago)
- Topics: boilerplate, django, django-rest-framework, djangorestframework, python, template
- Language: Python
- Homepage:
- Size: 1.22 MB
- Stars: 23
- Watchers: 6
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
Django starter template
A comprehensive and easy-to-use starting point for your new API with Django and DRF.
## Key features
- ๐งช Fully tested with [Pytest](https://docs.pytest.org/en/stable/).
- ๐ Enjoy the latest version of [Django](https://docs.djangoproject.com/en/5.1/) (5+) with all its features and improvements.
- ๐ ๏ธ [Django Rest Framework](https://www.django-rest-framework.org/) for building APIs.
- ๐ฟ Start your project with [PostgreSQL](https://www.postgresql.org/) without the need to install and configure it.
- ๐ฆ [Redis](https://redis.io/) caching out of the box.
- ๐ Login, Logout, Logout all, User profile and creation with [Knox](https://jazzband.github.io/django-rest-knox/), an easy-to-use authentication for DRF.
- ๐ Extended user model and a custom manager. Start with the email as the unique identifier.
- ๐๏ธ A custom [BaseModel](/apps/core/models.py) to easily add `created_at` and `updated_at` fields to your models.
- ๐๏ธ A custom [SoftDeleteBaseModel](/apps/core/models.py) to add soft delete functionality to the models you choose to.
- โณ Fully configured asynchronous tasks with [Celery](https://docs.celeryq.dev/en/stable/). It also includes a reusable [BaseTaskWithRetry](/apps/core/tasks.py).
- ๐๏ธ [django_celery_results](https://django-celery-results.readthedocs.io/en/latest/) enables Celery to store task results using Django's database backend.
- ๐ [django_celery_beat](https://django-celery-beat.readthedocs.io/en/latest/) for periodic task scheduling using the Django admin interface.
- ๐ฝ [django-filter](https://django-filter.readthedocs.io/en/stable/) add support for complex filtering of querysets in Django and DRF views.
- โก[Test your queries and code](/notebook.ipynb) interactively with [Jupyter Notebooks](https://jupyter.org/).
- ๐ [Django Debug Toolbar](https://django-debug-toolbar.readthedocs.io/en/latest/) for debugging and profiling.
- ๐งฉ [Django Extensions](https://django-extensions.readthedocs.io/en/latest/) for custom management commands and model enhancements.
- ๐ง Get out of the box code formatting with [Black](https://black.readthedocs.io/en/stable/), linting with [Flake8](https://flake8.pycqa.org/en/latest/) and test with [Pytest](https://docs.pytest.org/en/stable/).
- ๐จโ๐ป Develop with [VS Code](https://code.visualstudio.com/) and [Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers).## Requirements
- ๐ป VS Code
- ๐ Docker
- ๐ณ Docker Compose## How to use
1. Clone the repo or use it as a template to start a new project.
![use](/static/USE.png)
1. Open the project in VS Code.
1. If you installed the recommended extensions, open `Todo Tree` in the sidebar. It will guide you trough the first steps setting up your project, like changing the name of the container, adjusting your URLS, etc.
![todo](/static/TODO.png)
1. โ ๏ธ Use `env.example` to create a `.env` file.
1. Hit `CTL/CMD + Shift + p` and select `Reopen in container`. This will:
- Create a dev container.
- Setup a Redis server.
- Setup your PostgreSQL database.
- Install the dependencies.
- Migrate the database.
1. Create your super user with `python manage.py createsuperuser`.
1. Run the project with `python manage.py reserver`.
1. Work as usual.## Commands
This template comes with some shortcuts so you don't have to memorize how to start the workers:
- `poetry run worker`: to start a new Celery worker.
- `poetry run beat`: to start your periodic tasks.You can also use:
- `poetry run server` instead of `python manage.py runserver`
- `poetry run makemigrations` instead of `python manage.py makemigrations`
- `poetry run migrate` instead of `python manage.py migrate`## Todo
- [x] Index Page with a link to the Django admin
- [ ] Add method to restore soft deleted data
- [ ] Email sending with celery
- [ ] Data seeding
- [ ] API Versioning
- [ ] OpenAPI 3 schema auto generation and Swagger
- [ ] Production Docker file
- [ ] Production Docker compose file
- [ ] CI/CD with Github Actions