diff --git a/.gitignore b/.gitignore index c38aee7..c631ec5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ venv .env env /enviroments -# \ No newline at end of file +# +.vercel diff --git a/index.py b/index.py new file mode 100644 index 0000000..a1b285c --- /dev/null +++ b/index.py @@ -0,0 +1,6 @@ +import uvicorn + + +if __name__ == '__main__': # pragma: no cover + port = 8002 + uvicorn.run('src.main:app', reload=True, port=int(port), host="0.0.0.0") \ No newline at end of file diff --git a/src/controller/pautaController.py b/src/controller/pautaController.py index 5cce6fe..d021923 100644 --- a/src/controller/pautaController.py +++ b/src/controller/pautaController.py @@ -1,5 +1,4 @@ import os -from dotenv import load_dotenv from fastapi_mail import ConnectionConfig, FastMail, MessageSchema, MessageType from ..domain.models.pautaSchema import EmailSchema from starlette.responses import JSONResponse @@ -9,8 +8,6 @@ prefix="/pauta" ) -load_dotenv() - MAIL_USERNAME=os.getenv("MAIL_USERNAME") MAIL_PASSWORD=os.getenv("MAIL_PASSWORD") MAIL_FROM=os.getenv("MAIL_FROM") diff --git a/src/main.py b/src/main.py index bb7d6e3..bfbfc67 100644 --- a/src/main.py +++ b/src/main.py @@ -1,9 +1,9 @@ -from typing import List from fastapi.middleware.cors import CORSMiddleware -from fastapi import BackgroundTasks, FastAPI +from fastapi import FastAPI + + from src.controller import pautaController -import sys -import uvicorn +# import sys app = FastAPI() @@ -24,9 +24,9 @@ def read_root(): return {"message": "UnB-TV!"} -if __name__ == '__main__': - port = 8080 - if (len(sys.argv) == 2): - port = sys.argv[1] +# if __name__ == '__main__': +# port = 8080 +# if (len(sys.argv) == 2): +# port = sys.argv[1] - uvicorn.run('main:app', reload=True, port=int(port), host="0.0.0.0") \ No newline at end of file +uvicorn.run('main:app', reload=True, port=int(port), host="0.0.0.0") diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..cfbd1ec --- /dev/null +++ b/vercel.json @@ -0,0 +1,15 @@ +{ + "builds": [ + { + "src": "src/main.py", + "use": "@vercel/python", + "config": {"maxLambdaSize": "15mb"} + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "src/main.py" + } + ] +}