Aiogram bot template by Forzend
Template based on Forden's template for creating scalable bots with aiogram
-
Make sure you have installed cookiecutter.
-
Generate project
cookiecutter https://github.com/0Kit/aiogram_template.git
-
Create an environment
Make sure you have installed poetry
poetry install
-
Make changes to the project
-
Make migrations (Choose one of the options)
Using make
make makemigrations
Using poetry
poetry run alembic revision --autogenerate -m init
-
Run project (Choose one of the options)
In docker container(using make)
Make sure you have installed poetry and Make
make app-create
In Docker(without extraneous tools)
docker-compose up -d
In your system
python3 -m app
Click here to see some system dependencies
- Python
- Poetry
- Docker
- docker-compose
- make [required]
- app — the source of the application
- filters — module with custom
- handlers — module with all project handlers
- keyboards — module with telegram keyboards
- inline
- reply
- middlewares — module with aiogram middlewares
- models — module with database models
- states — module aiogram state groups
- utils — module with any project utils
- main.py — Entrypoint
- config.py — project constants loaded from the. env file
- misc.py — project global varibles there
- migrations — database migration module [automatically generated by alembic]
- scripts — bash scripts * docker-entrypoint.sh — bash script for launching the application in a Docker container
- .env.dist — example for .env file
- .flake8 — flake8 config
All commands are in the Makefile
and are used by make [options] [command] [variables]
app-create
— build and run start application
app-logs
— check application log
app-strart
— start the application
app-stop
— stop the application
app-down
— down the application
app-destroy
— down the application with removing containers for services not defined in the
Compose file and named volumes declared in the volumes
section of the Compose file and anonymous
volumes attached to containers.
Click here to see all make commands
isort
— format code using isort
black
— format code using black
flake8
— lint code using flake8
lint
— use all code formatters and linters
alembic ${args}
— run alembic with some args
makemigrations
— create new migrations based on the changes you have made to your models.
migrate
— apply all migrations
downgrade
— go back to the previous version of migrations
docker-config
— is the same as docker-compose config
docker-ps
— is the same as docker-compose ps
docker-build
— is the same as docker-compose build
docker-up-dependencies
— up dependencies in docker-compose
docker-up
— up the app with its dependencies
docker-stop
— is the same as docker-compose stop
docker-down
— is the same as docker-compose down
docker-destroy
— destroy application
docker-logs
— show application log