forked from open-webui/open-webui
		
	Merge pull request #1825 from cheahjs/feat/allow-backend-to-run-without-frontend
This commit is contained in:
		
						commit
						7bc17da534
					
				
					 2 changed files with 15 additions and 6 deletions
				
			
		|  | @ -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 | ||||
|  |  | |||
|  | @ -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( | ||||
|     "/", | ||||
|     SPAStaticFiles(directory=FRONTEND_BUILD_DIR, html=True), | ||||
|     name="spa-static-files", | ||||
| ) | ||||
| 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") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy Jaeryang Baek
						Timothy Jaeryang Baek