diff --git a/app.py b/app.py deleted file mode 100644 index bc73234..0000000 --- a/app.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Точка входа для gunicorn — app:app.""" -from app import create_app - -app = create_app() diff --git a/app/__init__.py b/app/__init__.py deleted file mode 100644 index d74103a..0000000 --- a/app/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -"""Flask-приложение — фабрика.""" -from flask import Flask - -import config - - -def create_app() -> Flask: - app = Flask(__name__, static_folder="static", template_folder="templates") - app.config.from_object(config) - - from app.routes.main import bp as main_bp - app.register_blueprint(main_bp) - - return app diff --git a/config.py b/config.py deleted file mode 100644 index 1db80bd..0000000 --- a/config.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Конфигурация приложения — всё из переменных окружения.""" - -import os - -# API облака -NUBES_API_ENDPOINT = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc") -NUBES_API_TOKEN = os.getenv("NUBES_API_TOKEN", "") - -# Flask -SECRET_KEY = os.getenv("SECRET_KEY", "dev-secret-change-in-production") -DEBUG = os.getenv("DEBUG", "false").lower() == "true" diff --git a/run.py b/run.py deleted file mode 100644 index 04d245f..0000000 --- a/run.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Точка входа.""" -from app import create_app - -app = create_app() - -if __name__ == "__main__": - app.run(host="0.0.0.0", port=5000) diff --git a/app/api/__init__.py b/site/__init__.py similarity index 100% rename from app/api/__init__.py rename to site/__init__.py diff --git a/app/operations/__init__.py b/site/api/__init__.py similarity index 100% rename from app/operations/__init__.py rename to site/api/__init__.py diff --git a/app/api/http_client.py b/site/api/http_client.py similarity index 100% rename from app/api/http_client.py rename to site/api/http_client.py diff --git a/site/app.py b/site/app.py new file mode 100644 index 0000000..f16d5de --- /dev/null +++ b/site/app.py @@ -0,0 +1,18 @@ +"""Точка входа — запускается как python site/app.py.""" +import os +import sys + +# site/ не может быть пакетом (конфликт с stdlib site.py) +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) + +from flask import Flask + +from routes.main import bp as main_bp + +NUBES_API_ENDPOINT = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc") +NUBES_API_TOKEN = os.getenv("NUBES_API_TOKEN", "") + +app = Flask(__name__) +app.config["NUBES_API_ENDPOINT"] = NUBES_API_ENDPOINT +app.config["NUBES_API_TOKEN"] = NUBES_API_TOKEN +app.register_blueprint(main_bp) diff --git a/app/routes/__init__.py b/site/operations/__init__.py similarity index 100% rename from app/routes/__init__.py rename to site/operations/__init__.py diff --git a/app/operations/get_instances.py b/site/operations/get_instances.py similarity index 93% rename from app/operations/get_instances.py rename to site/operations/get_instances.py index f4de6af..f099b75 100644 --- a/app/operations/get_instances.py +++ b/site/operations/get_instances.py @@ -1,6 +1,6 @@ """GET /instances — получить список инстансов пользователя.""" -from app.api.http_client import HttpClient +from api.http_client import HttpClient def get_instances(client: HttpClient) -> list[dict]: diff --git a/site/routes/__init__.py b/site/routes/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/routes/main.py b/site/routes/main.py similarity index 83% rename from app/routes/main.py rename to site/routes/main.py index d2fe989..c81522b 100644 --- a/app/routes/main.py +++ b/site/routes/main.py @@ -2,8 +2,8 @@ from flask import Blueprint, current_app, render_template -from app.api.http_client import HttpClient -from app.operations.get_instances import get_organization +from api.http_client import HttpClient +from operations.get_instances import get_organization bp = Blueprint("main", __name__) diff --git a/app/static/favicon.svg b/site/static/favicon.svg similarity index 100% rename from app/static/favicon.svg rename to site/static/favicon.svg diff --git a/app/static/logo.svg b/site/static/logo.svg similarity index 100% rename from app/static/logo.svg rename to site/static/logo.svg diff --git a/app/static/style.css b/site/static/style.css similarity index 100% rename from app/static/style.css rename to site/static/style.css diff --git a/app/templates/base.html b/site/templates/base.html similarity index 100% rename from app/templates/base.html rename to site/templates/base.html diff --git a/app/templates/index.html b/site/templates/index.html similarity index 100% rename from app/templates/index.html rename to site/templates/index.html