瀏覽代碼

extracted APP_IMPORT_STRING for monkey patching

Rodja Trappe 1 年之前
父節點
當前提交
f1f173d032
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      nicegui/run.py

+ 3 - 1
nicegui/run.py

@@ -16,6 +16,8 @@ from . import native as native_module
 from . import native_mode
 from . import native_mode
 from .language import Language
 from .language import Language
 
 
+APP_IMPORT_STRING = 'nicegui:app'
+
 
 
 class Server(uvicorn.Server):
 class Server(uvicorn.Server):
 
 
@@ -124,7 +126,7 @@ def run(*,
     # NOTE: The following lines are basically a copy of `uvicorn.run`, but keep a reference to the `server`.
     # NOTE: The following lines are basically a copy of `uvicorn.run`, but keep a reference to the `server`.
 
 
     config = uvicorn.Config(
     config = uvicorn.Config(
-        'nicegui:app' if reload else globals.app,
+        APP_IMPORT_STRING if reload else globals.app,
         host=host,
         host=host,
         port=port,
         port=port,
         reload=reload,
         reload=reload,