I’m building an API using PyInstaller 6.4.0, but it’s not working.
For some reason, the built file is not recognizing my routes.
The project folder structure is:
markdown
Copiar código
API
├── logs
└── v1
└── routes
├── router1.py
└── router2.py
The code is:
[imports]
rprefix = f"/api/v1"
app = FastAPI()
[...]
router_prices = importlib.import_module(f"v1.routes.checkprices_routes")
router_commons = importlib.import_module(f"v1.routes.commons_routes")
[...]
app.include_router(
router_prices.__getattribute__("check_prices_router"), prefix=rprefix
)
app.include_router(router_commons.__getattribute__("commons_router"), prefix=rprefix)
if __name__ == "__main__":
if len(SSL_KEY) > 0 and len(SSL_CERT) > 0:
uvicorn.run(
"main:app",
host=API_HOST,
port=API_PORT,
reload=False,
ssl_keyfile=SSL_KEY,
ssl_certfile=SSL_CERT,
)
else:
uvicorn.run("main:app", host=API_HOST, port=API_PORT, reload=False)
screenshot:
P.S: The project is currently running on VSCode; it just doesn’t work after building.