Compare commits
2 Commits
5a5f307c33
...
a0f4ef9389
Author | SHA1 | Date |
---|---|---|
Анатолий Богомолов | a0f4ef9389 | |
Анатолий Богомолов | f272323480 |
|
@ -1,11 +1,11 @@
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
from config import Config
|
from config import config
|
||||||
from app.blueprints import blueprints
|
from app.blueprints import blueprints
|
||||||
from app.extensions import db, migrate
|
from app.extensions import db, migrate
|
||||||
from app.celery import celery_init_app
|
from app.celery import celery_init_app
|
||||||
|
|
||||||
def create_app(config_class=Config):
|
def create_app(config_class=config):
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_object(config_class)
|
app.config.from_object(config_class)
|
||||||
|
|
||||||
|
|
14
config.py
14
config.py
|
@ -2,8 +2,8 @@ import os
|
||||||
|
|
||||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
class Config:
|
|
||||||
SECRET_KEY = os.environ.get('SECRET_KEY')
|
class ProductionConfig:
|
||||||
SQLALCHEMY_DATABASE_URI = f"postgresql://{os.environ.get('POSTGRES_USER')}:{os.environ.get('POSTGRES_PASSWORD')}@postgres/{os.environ.get('POSTGRES_DB')}"
|
SQLALCHEMY_DATABASE_URI = f"postgresql://{os.environ.get('POSTGRES_USER')}:{os.environ.get('POSTGRES_PASSWORD')}@postgres/{os.environ.get('POSTGRES_DB')}"
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
CELERY = dict(
|
CELERY = dict(
|
||||||
|
@ -12,3 +12,13 @@ class Config:
|
||||||
task_ignore_result=True,
|
task_ignore_result=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class DebugConfig:
|
||||||
|
SQLALCHEMY_DATABASE_URI = f"postgresql://postgres:123456789@localhost:5432/paper"
|
||||||
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
|
CELERY = dict(
|
||||||
|
broker_url="redis://localhost:6379/0",
|
||||||
|
result_backend="redis://localhost:6379/0",
|
||||||
|
task_ignore_result=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
config = DebugConfig
|
|
@ -28,7 +28,7 @@ from telethon.errors.rpcerrorlist import (
|
||||||
|
|
||||||
class PaperClient(TelegramClient):
|
class PaperClient(TelegramClient):
|
||||||
def __init__(self, session: str | Session) -> None:
|
def __init__(self, session: str | Session) -> None:
|
||||||
api = API.TelegramAndroid.Generate("paper")
|
api = API.TelegramDesktop.Generate("linux", "paper")
|
||||||
super().__init__(session, api)
|
super().__init__(session, api)
|
||||||
|
|
||||||
async def invite_self(self, group: Entity | EntityLike):
|
async def invite_self(self, group: Entity | EntityLike):
|
||||||
|
|
Loading…
Reference in New Issue