diff --git a/config/.env.template b/app/config/.env.template similarity index 100% rename from config/.env.template rename to app/config/.env.template diff --git a/app/core/bot.py b/app/core/bot.py index b2a9e16..f3f7d1b 100644 --- a/app/core/bot.py +++ b/app/core/bot.py @@ -6,13 +6,14 @@ from aiogram.dispatcher import Dispatcher from aiogram.dispatcher.webhook import SendMessage from aiogram.utils.callback_data import CallbackData -from core.parse_web import parse_site, configure_firefox_driver +from core.parse_web import parse_site, configure_firefox_driver, download_gecko_driver from settings import API_TOKEN bot = Bot(token=API_TOKEN) dispatcher = Dispatcher(bot) dispatcher.middleware.setup(LoggingMiddleware()) +download_gecko_driver() driver = configure_firefox_driver() stations_cb = CallbackData('station', 'direction') diff --git a/app/delete.py b/app/delete.py new file mode 100644 index 0000000..e6d64aa --- /dev/null +++ b/app/delete.py @@ -0,0 +1,3 @@ +from pathlib import Path + +print(Path(__file__).parent.parent) \ No newline at end of file diff --git a/app/main.py b/app/main.py index 201190a..c771b25 100644 --- a/app/main.py +++ b/app/main.py @@ -2,7 +2,6 @@ from aiogram.utils.executor import start_webhook from core.bot import bot, dispatcher from core.logger import logger -from core.parse_web import download_gecko_driver from core.scheduler import asyncio_schedule from settings import WEBHOOK_URL, WEBHOOK_PATH, WEBAPP_HOST, WEBAPP_PORT @@ -26,7 +25,6 @@ async def on_shutdown(dispatcher): if __name__ == '__main__': - download_gecko_driver() start_webhook( dispatcher=dispatcher, diff --git a/app/settings.py b/app/settings.py index 6b4062d..8af3ca7 100644 --- a/app/settings.py +++ b/app/settings.py @@ -4,7 +4,7 @@ from decouple import AutoConfig # Build paths inside the project like this: BASE_DIR.joinpath('some') # `pathlib` is better than writing: dirname(dirname(dirname(__file__))) -BASE_DIR = Path(__file__).parent.parent +BASE_DIR = Path(__file__).parent # Loading `.env` files # See docs: https://gitlab.com/mkleehammer/autoconfig