您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829
  1. from fastapi import FastAPI
  2. from core.config import settings, createAdminAcc
  3. from db.session import engine
  4. from db.base import Base
  5. from apis.base import api_router
  6. def include_routes(app): # include all routes from our api/v1/
  7. app.include_router(api_router)
  8. def startup(): # start the project, and create the tables
  9. app = FastAPI(
  10. title=settings.PROJECT_NAME,
  11. version=settings.PROJECT_VERSION,
  12. )
  13. Base.metadata.create_all(bind=engine)
  14. createAdminAcc()
  15. include_routes(app)
  16. return app
  17. app = startup()
  18. # Testing stuff
  19. @app.get("/")
  20. def root():
  21. return {"message": "Hello World!"}