vault backup: 2024-06-17 15:08:21
This commit is contained in:
27
30. 工作 - Logitech/code - AutoServer.md
Normal file
27
30. 工作 - Logitech/code - AutoServer.md
Normal file
@@ -0,0 +1,27 @@
|
||||
- https://docs.google.com/presentation/d/1GjFDFGEs0zxNdesxZu4pL-bNX6uPzfuA/edit#slide=id.p1
|
||||
|
||||
### Build to EXE
|
||||
|
||||
#### 遇到的問題
|
||||
|
||||
##### 如何將 `flask db migrate` 寫成 script ?
|
||||
|
||||
```python
|
||||
import app
|
||||
from flask_migrate import upgrade
|
||||
|
||||
appInstance = app.createApp()
|
||||
with appInstance.app_context():
|
||||
upgrade()
|
||||
```
|
||||
|
||||
##### 執行 `dbUpgrade.exe` 的時候,發生 `Error: Path doesn't exist: 'C:\\SynologyDrive\\codes\\Logitech\\project\\AutoServer_buildexe\\Server\\release_exe\\autoserver\\migrations'. Please use the 'init' command to create a new scripts folder.`
|
||||
|
||||
因為找不到 `migrations` 這個資料夾,要把 `migrations` 一併 copy 到 `dbUpgrade.exe` 的所在目錄。
|
||||
|
||||
##### 已經有 `migrations` 資料夾,執行 `dbUpgrade.exe` 的時候,發生 `ModuleNotFoundError: No module named 'logging.config'`
|
||||
|
||||
pyinstaller 沒有包到 logging 模組,用 `--hidden-import` 把它包進來即可。
|
||||
```bash
|
||||
pyinstaller --hidden-import logging --hidden-import logging.config -F dbUpgrade.py
|
||||
```
|
||||
Reference in New Issue
Block a user