We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 430a44d commit 2413133Copy full SHA for 2413133
app.py
@@ -1,10 +1,13 @@
1
+import os
2
+
3
from fastapi import FastAPI
4
from fastapi import Request
5
from fastapi.templating import Jinja2Templates
6
7
from routes.v1 import email
8
from routes.v1 import contact
9
from routes.v1 import company
10
+from settings import LOG_FILE
11
12
app = FastAPI()
13
app.include_router(email.router)
@@ -19,3 +22,14 @@ def home(request: Request):
19
22
return templates.TemplateResponse(
20
23
"charge.html", {"request": request, "message": "Welcome to Property Management API"}
21
24
)
25
26
27
+@app.on_event("startup")
28
+async def startup_event():
29
+ try:
30
+ os.makedirs(LOG_FILE)
31
+ if not os.path.exists(LOG_FILE):
32
+ os.mknod(LOG_FILE)
33
+ except FileExistsError:
34
+ # directory already exists
35
+ pass
0 commit comments