This template serves as your trustworthy compass in the realm of Python development. It's built upon the principles of Clean Architecture, which empower you to create code that's readable, maintainable, and scalable.
Clean Architecture makes your projects resilient to change and ready to scale. It divides your code into logical layers, making it a breeze to add new features and maintain the existing ones.
This template is suitable for both beginners and seasoned developers. Regardless of your skill level, you'll find everything you need to level up your skills.
A project structure ready for Clean Architecture principles. Easy configuration using '.env' files. A powerful Python toolkit for development and testing. Examples and tips for a quick start.
Use this template to craft Python applications that are easy to maintain, extend, and customize. Elevate your code to a new level and acquaint yourself with the world of Clean Architecture. Code that leaves an impression. π»π
NOTE: The project uses Python 3.11, so need it installed first. It is recommended to use pyenv
for installation.
NOTE: Root of the django project is at the src
folder
Here is a short instruction on how to quickly set up the project for development:
Install poetry
Clone
$ git clone https://github.com/azizjon-aliev/python_clean_architecture.git
Install requirements:
$ poetry install
$ poetry shell
Install pre-commit hooks: $ pre-commit install
Add and setup .env file: $ cp .env.example .env
-> edit .env
Initiate the database: $ python manage.py migrate
Run the server: $ python manage.py runserver
Create docker images and execute the containers for development. From the project directory:
$ docker-compose -f docker/docker-compose.yml -f docker/docker-compose.dev.yml --env-file ./.env up -d --build
Execute the docker containers with environment variables setup for testing:
$ docker-compose -f docker/docker-compose.yml -f docker/docker-compose.test.yml --env-file ./.env up -d --build
Access running api backend _apicontainer docker container shell:
docker exec -it api_container bash
Execute pytest command from project directory:
pytest