fix: remove debug print(req.scope) from get_docs route (#32) #34
46
app/main.py
46
app/main.py
@ -6,15 +6,42 @@ from fastapi.openapi.utils import get_openapi
|
|||||||
# from fastapi.templating import Jinja2Templates
|
# from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
from .routers_v2 import (
|
from .routers_v2 import (
|
||||||
current, awards, teams, rarity, cardsets, players, packtypes, packs, cards, events, results, rewards, decisions,
|
current,
|
||||||
batstats, pitstats, notifications, paperdex, gamerewards, gauntletrewards, gauntletruns, battingcards,
|
awards,
|
||||||
battingcardratings, pitchingcards, pitchingcardratings, cardpositions, scouting, mlbplayers, stratgame, stratplays)
|
teams,
|
||||||
|
rarity,
|
||||||
|
cardsets,
|
||||||
|
players,
|
||||||
|
packtypes,
|
||||||
|
packs,
|
||||||
|
cards,
|
||||||
|
events,
|
||||||
|
results,
|
||||||
|
rewards,
|
||||||
|
decisions,
|
||||||
|
batstats,
|
||||||
|
pitstats,
|
||||||
|
notifications,
|
||||||
|
paperdex,
|
||||||
|
gamerewards,
|
||||||
|
gauntletrewards,
|
||||||
|
gauntletruns,
|
||||||
|
battingcards,
|
||||||
|
battingcardratings,
|
||||||
|
pitchingcards,
|
||||||
|
pitchingcardratings,
|
||||||
|
cardpositions,
|
||||||
|
scouting,
|
||||||
|
mlbplayers,
|
||||||
|
stratgame,
|
||||||
|
stratplays,
|
||||||
|
)
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
# root_path='/api',
|
# root_path='/api',
|
||||||
responses={404: {'description': 'Not found'}},
|
responses={404: {"description": "Not found"}},
|
||||||
docs_url='/api/docs',
|
docs_url="/api/docs",
|
||||||
redoc_url='/api/redoc'
|
redoc_url="/api/redoc",
|
||||||
)
|
)
|
||||||
|
|
||||||
# app.mount("/static", StaticFiles(directory="storage/static"), name="static")
|
# app.mount("/static", StaticFiles(directory="storage/static"), name="static")
|
||||||
@ -53,10 +80,11 @@ app.include_router(decisions.router)
|
|||||||
|
|
||||||
@app.get("/api/docs", include_in_schema=False)
|
@app.get("/api/docs", include_in_schema=False)
|
||||||
async def get_docs(req: Request):
|
async def get_docs(req: Request):
|
||||||
print(req.scope)
|
return get_swagger_ui_html(
|
||||||
return get_swagger_ui_html(openapi_url=req.scope.get('root_path')+'/openapi.json', title='Swagger')
|
openapi_url=req.scope.get("root_path") + "/openapi.json", title="Swagger"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/api/openapi.json", include_in_schema=False)
|
@app.get("/api/openapi.json", include_in_schema=False)
|
||||||
async def openapi():
|
async def openapi():
|
||||||
return get_openapi(title='Paper Dynasty API', version=f'0.1.1', routes=app.routes)
|
return get_openapi(title="Paper Dynasty API", version=f"0.1.1", routes=app.routes)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user