refactor: 优化main.py,移除无效代码和浏览器自动打开功能
- 移除了`extra-hooks/__init__.py`中的注释,该文件现在为空。 - 在`main.py`中移除了未使用的导入语句和函数,以及启动浏览器的代码。 - 删除了`main.spec`文件,因为它是PyInstaller打包配置的一部分,现在的更改侧重于源代码的清理和优化。
This commit is contained in:
@@ -1,27 +1,13 @@
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import threading
|
||||
import webbrowser
|
||||
|
||||
root_path = os.getcwd()
|
||||
sys.path.append(root_path)
|
||||
import uvicorn
|
||||
from pathlib import Path
|
||||
from application.settings import LOGGING
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
url = "http://127.0.0.1:8000/web/"
|
||||
|
||||
|
||||
def open_browser_after_delay(url, delay):
|
||||
time.sleep(delay)
|
||||
webbrowser.open(url)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
multiprocessing.freeze_support()
|
||||
threading.Thread(target=open_browser_after_delay, args=(url, 3)).start()
|
||||
uvicorn.run("application.asgi:application", reload=False, host="0.0.0.0", port=8000, workers=4,
|
||||
log_config=LOGGING)
|
||||
|
||||
Reference in New Issue
Block a user