do something when fastapi start
This commit is contained in:
parent
229d1eed13
commit
473efe528c
2 changed files with 5 additions and 1 deletions
|
@ -11,7 +11,7 @@ COPY static ./static
|
|||
COPY requirements.txt main.py database.sqlite ./
|
||||
RUN apt update
|
||||
|
||||
# Install supervisord
|
||||
# Install supervisords
|
||||
RUN apt install -y supervisor
|
||||
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY config/cmd.sh /cmd.sh
|
||||
|
|
|
@ -13,6 +13,10 @@ from fastapi.openapi.docs import (
|
|||
myLogger.info_logger("Start server...")
|
||||
app = FastAPI(docs_url=None, redoc_url=None, openapi_url="/")
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup_event():
|
||||
print("应用程序已启动!")
|
||||
|
||||
def get_app():
|
||||
origins = [
|
||||
"http://localhost",
|
||||
|
|
Loading…
Add table
Reference in a new issue