Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
siibra-explorer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiao Gui
siibra-explorer
Commits
c8d0d524
Commit
c8d0d524
authored
1 year ago
by
Xiao Gui
Browse files
Options
Downloads
Patches
Plain Diff
fix: add ready flag
parent
a8fc561c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
backend/app/app.py
+11
-2
11 additions, 2 deletions
backend/app/app.py
with
11 additions
and
2 deletions
backend/app/app.py
+
11
−
2
View file @
c8d0d524
from
pathlib
import
Path
from
fastapi
import
FastAPI
,
Request
from
fastapi.responses
import
RedirectResponse
from
fastapi.responses
import
RedirectResponse
,
Response
from
fastapi.staticfiles
import
StaticFiles
from
starlette.middleware.sessions
import
SessionMiddleware
...
...
@@ -13,9 +13,16 @@ from app.plugin import router as plugin_router
from
app.auth
import
router
as
auth_router
from
app.user
import
router
as
user_router
from
app.config
import
HOST_PATHNAME
from
app.logger
import
logger
app
=
FastAPI
()
ready_flag
=
False
@app.get
(
"
/ready
"
)
def
ready
():
return
Response
(
None
,
204
if
ready_flag
else
500
)
app
.
add_middleware
(
SessionMiddleware
,
secret_key
=
SESSION_SECRET
)
for
vip_route
in
vip_routes
:
...
...
@@ -44,7 +51,9 @@ app.mount("/", StaticFiles(directory=Path(PATH_TO_PUBLIC)), name="static")
if
HOST_PATHNAME
:
assert
HOST_PATHNAME
[
0
]
==
"
/
"
,
f
"
HOST_PATHNAME, if defined, must start with /:
{
HOST_PATHNAME
!r}
"
assert
HOST_PATHNAME
[
-
1
]
!=
"
/
"
,
f
"
HOST_PATHNAME, if defined, must not end with /:
{
HOST_PATHNAME
!r}
"
logger
.
info
(
f
"
listening on path
{
HOST_PATHNAME
}
"
)
_app
=
app
app
=
FastAPI
()
app
.
mount
(
HOST_PATHNAME
,
_app
)
ready_flag
=
True
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment