From 43675b2d1d1e8b9ff3a66b47afbb73ff3de63425 Mon Sep 17 00:00:00 2001 From: inexcode Date: Fri, 12 Aug 2022 17:43:04 +0400 Subject: [PATCH] Programmatical uvicorn start --- pyproject.toml | 4 ++-- selfprivacy_api/app.py | 5 +++++ setup.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1ffd18c..7f8d872 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "wheel", "portalocker", "flask-swagger", "flask-swagger-ui"] -build-backend = "setuptools.build_meta" \ No newline at end of file +requires = ["setuptools", "wheel", "portalocker"] +build-backend = "setuptools.build_meta" diff --git a/selfprivacy_api/app.py b/selfprivacy_api/app.py index a65b47b..60fac7f 100644 --- a/selfprivacy_api/app.py +++ b/selfprivacy_api/app.py @@ -5,6 +5,8 @@ from fastapi import FastAPI, Depends, Request, WebSocket, BackgroundTasks from fastapi.middleware.cors import CORSMiddleware from strawberry.fastapi import BaseContext, GraphQLRouter +import uvicorn + from selfprivacy_api.dependencies import get_api_version, get_graphql_context from selfprivacy_api.graphql.schema import schema from selfprivacy_api.migrations import run_migrations @@ -49,3 +51,6 @@ async def get_version(): async def startup(): run_migrations() init_restic() + +if __name__ == "__main__": + uvicorn.run("app:app", host="0.0.0.0", port=5050, log_level="info") diff --git a/setup.py b/setup.py index 5619621..eabc165 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="selfprivacy_api", - version="1.2.7", + version="2.0.0", packages=find_packages(), scripts=[ "selfprivacy_api/app.py",