Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
6a1d60b1
Commit
6a1d60b1
authored
Apr 28, 2024
by
Jun Siang Cheah
Browse files
feat: warn but not exit if frontend build does not exist
parent
f070e8b7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
backend/config.py
backend/config.py
+5
-1
backend/main.py
backend/main.py
+10
-5
No files found.
backend/config.py
View file @
6a1d60b1
...
...
@@ -168,7 +168,11 @@ except:
STATIC_DIR
=
str
(
Path
(
os
.
getenv
(
"STATIC_DIR"
,
"./static"
)).
resolve
())
shutil
.
copyfile
(
f
"
{
FRONTEND_BUILD_DIR
}
/favicon.png"
,
f
"
{
STATIC_DIR
}
/favicon.png"
)
frontend_favicon
=
f
"
{
FRONTEND_BUILD_DIR
}
/favicon.png"
if
os
.
path
.
exists
(
frontend_favicon
):
shutil
.
copyfile
(
frontend_favicon
,
f
"
{
STATIC_DIR
}
/favicon.png"
)
else
:
logging
.
warning
(
f
"Frontend favicon not found at
{
frontend_favicon
}
"
)
####################################
# CUSTOM_NAME
...
...
backend/main.py
View file @
6a1d60b1
...
...
@@ -318,11 +318,16 @@ async def get_manifest_json():
app
.
mount
(
"/static"
,
StaticFiles
(
directory
=
STATIC_DIR
),
name
=
"static"
)
app
.
mount
(
"/cache"
,
StaticFiles
(
directory
=
CACHE_DIR
),
name
=
"cache"
)
app
.
mount
(
if
os
.
path
.
exists
(
FRONTEND_BUILD_DIR
):
app
.
mount
(
"/"
,
SPAStaticFiles
(
directory
=
FRONTEND_BUILD_DIR
,
html
=
True
),
name
=
"spa-static-files"
,
)
)
else
:
log
.
warning
(
f
"Frontend build directory not found at '
{
FRONTEND_BUILD_DIR
}
'. Serving API only."
)
@
app
.
on_event
(
"shutdown"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment