Initial commit: InviteMe production redesign
This commit is contained in:
@@ -16,6 +16,8 @@ Production-система регистрации гостей, рассылки
|
|||||||
Нужны Linux-сервер с Docker Compose, домен, направленный на сервер, и открытые входящие порты 80/443.
|
Нужны Linux-сервер с Docker Compose, домен, направленный на сервер, и открытые входящие порты 80/443.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
git clone https://git.mycloud24.ru/insight/InviteMe.git
|
||||||
|
cd InviteMe
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
# Заполните DOMAIN и сгенерируйте три секрета в .env.
|
# Заполните DOMAIN и сгенерируйте три секрета в .env.
|
||||||
docker compose up -d --build
|
docker compose up -d --build
|
||||||
|
|||||||
+13
-1
@@ -52,8 +52,8 @@ def create_app(config_class=Config):
|
|||||||
|
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
if not app.config.get("SKIP_DB_BOOTSTRAP"):
|
if not app.config.get("SKIP_DB_BOOTSTRAP"):
|
||||||
|
_run_migrations()
|
||||||
if not app.config.get("IS_PRODUCTION"):
|
if not app.config.get("IS_PRODUCTION"):
|
||||||
db.create_all()
|
|
||||||
_migrate_existing_data(app)
|
_migrate_existing_data(app)
|
||||||
_migrate_legacy_public_uploads(app)
|
_migrate_legacy_public_uploads(app)
|
||||||
_load_smtp_settings(app)
|
_load_smtp_settings(app)
|
||||||
@@ -61,6 +61,18 @@ def create_app(config_class=Config):
|
|||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
def _run_migrations():
|
||||||
|
"""Применяет миграции Alembic к текущей базе данных."""
|
||||||
|
from alembic.config import Config as AlembicConfig
|
||||||
|
from alembic import command
|
||||||
|
|
||||||
|
migrations_dir = Path(__file__).resolve().parent.parent / "migrations"
|
||||||
|
alembic_ini = migrations_dir / "alembic.ini"
|
||||||
|
alembic_cfg = AlembicConfig(str(alembic_ini))
|
||||||
|
alembic_cfg.set_main_option("script_location", str(migrations_dir))
|
||||||
|
command.upgrade(alembic_cfg, "head")
|
||||||
|
|
||||||
|
|
||||||
def _load_smtp_settings(app):
|
def _load_smtp_settings(app):
|
||||||
"""Загружает SMTP-настройки из базы в конфиг приложения."""
|
"""Загружает SMTP-настройки из базы в конфиг приложения."""
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user