webshining / aiogram-sqlalchemy-template

Aiogram template with sqlalchemy orm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Aiogram Mongo Template

Technologies used:

  • Aiogram
  • Redis
  • SQLAlchemy
  • SQLite3
  • PostgreSQL
  • i18n
  • Docker and docker compose

Navigate

Getting started

Init project

$ git clone -b aiogram3 https://github.com/webshining/aiogram-mongo-template project_name
$ cd project_name
$ pip install -r requirements.txt
$ poetry install # If you use poetry. Don't forget to select an interpreter

Configure environment variables

Copy variables from .env.ren file to .env

$ cp .env.ren .env

Bot config

TELEGRAM_BOT_TOKEN - your bot token (required)

I18N_DOMAIN - locales file name

Redis config

If you are not using redis, by default used MemoryStorage

RD_DB - your redis database (number)

RD_HOST - your redis host

RD_PORT - your redis port

You can specify RD_URI instead of RD_DB, RD_HOST and RD_PORT

RD_URI - connection url to your redis server

Database config

DB_URI format
> dialect+driver://username:password@host:port/database

DB_USER - your database username

DB_PASS - your database password

DB_NAME - your database name

DB_HOST - your database host

DB_PORT - your database port

You can specify DB_URI instead of DB_USER, DB_PASS, DB_NAME, DB_HOST and DB_PORT

DB_URI - connection url to your database server

Application start (local)

$ python main.py
# If you have make you can enter
$ make run

Docker

Application start (docker)

Run only one service:
$ docker-compose up -d service-name

$ docker-compose up -d
# If you have make you can enter
$ make rebuild

View app logs

$ docker-compose logs -f app
# If you have make you can enter
$ make logs

Rebuild app

$ docker-compose up -d --build --no-deps --force-recreate
# If you have make you can enter
$ make rebuild

About

Aiogram template with sqlalchemy orm

License:MIT License


Languages

Language:Python 89.1%Language:Makefile 4.8%Language:Mako 3.2%Language:Dockerfile 2.7%Language:Shell 0.2%