150 lines
3.1 KiB
Plaintext
150 lines
3.1 KiB
Plaintext
重新 build
|
||
sam build --no-cached
|
||
|
||
启动本地 API:
|
||
sam local start-api
|
||
|
||
|
||
C:\workspace\AWS\accounting-system\layers\psycopg2\python
|
||
|
||
|
||
如果你看到的是:
|
||
bash-4.2#
|
||
→ 这是 Amazon Linux 容器(正确)
|
||
你必须看到 bash-4.2# 才能执行 yum。
|
||
|
||
|
||
|
||
正确的データベース Host 是你的 NAS 内网 IP 地址
|
||
|
||
Host: 192.168.0.61
|
||
Port: 55432
|
||
User: postgres
|
||
Password: accounting123
|
||
Database: accounting njts_acct
|
||
|
||
|
||
DB_HOST=192.168.0.61
|
||
DB_PORT=55432
|
||
DB_NAME=njts_acct
|
||
DB_USER=njts_app
|
||
DB_PASSWORD=njts_app2025
|
||
|
||
----------------------
|
||
バージョン確認
|
||
python --version
|
||
|
||
pip --version
|
||
|
||
where python
|
||
|
||
where python 没有输出
|
||
|
||
这是好事,不是坏事:
|
||
|
||
说明:
|
||
|
||
没有多个 python 冲突
|
||
|
||
没有 WindowsApps / Microsoft Store 干扰
|
||
|
||
PowerShell 里 python 能正常执行,PATH 已经是正确的
|
||
|
||
👉 结论:Python 环境 = 教科书级干净
|
||
|
||
|
||
create_njts_accounting_core.bat
|
||
|
||
cd C:\workspace\njts-accounting-core\backend
|
||
|
||
python -m venv .venv
|
||
|
||
C:\workspace\njts-accounting-core\backend\.venv\pyvenv.cfg
|
||
home = C:\Users\zxh_y\AppData\Local\Programs\Python\Python312
|
||
include-system-site-packages = false
|
||
version = 3.12.9
|
||
executable = C:\Users\zxh_y\AppData\Local\Programs\Python\Python312\python.exe
|
||
command = C:\Users\zxh_y\AppData\Local\Programs\Python\Python312\python.exe -m venv C:\workspace\njts-accounting-core\backend\.venv
|
||
|
||
|
||
cd C:\workspace\njts-accounting-core\backend
|
||
.venv\Scripts\activate
|
||
uvicorn app.main:app --reload --host 127.0.0.1 --port 18080
|
||
|
||
http://localhost:18080/docs
|
||
|
||
backend\requirements.txt
|
||
ーーーーーーーーーーーーー
|
||
fastapi==0.115.6
|
||
uvicorn[standard]==0.32.1
|
||
ーーーーーーーーーーーー
|
||
|
||
pip install -r requirements.txt
|
||
|
||
|
||
backend\app\main.py
|
||
ーーーーーーーーーー
|
||
from fastapi import FastAPI
|
||
|
||
app = FastAPI(
|
||
title="NJTS Accounting Core API",
|
||
description="日本小規模企業向け 会計システム",
|
||
version="0.1.0"
|
||
)
|
||
|
||
@app.get("/")
|
||
def root():
|
||
return {
|
||
"message": "NJTS Accounting Core API is running",
|
||
"status": "ok"
|
||
}
|
||
|
||
|
||
|
||
pip install psycopg[binary]==3.2.3
|
||
|
||
|
||
C:\workspace\njts-accounting-core\backend uvicorn app.main:app --reload --host 127.0.0.1 --port 18080
|
||
|
||
|
||
|
||
version = 1:初始输入
|
||
|
||
version >= 2:你改过
|
||
|
||
updated_at:最后一次修改时间
|
||
|
||
updated_reason:
|
||
|
||
可空
|
||
|
||
例如:金额修正、补录摘要、对账调整
|
||
|
||
|
||
-------------------------------
|
||
/volume1/docker/rc_ollama_bot/
|
||
bot.py
|
||
① 停掉并删除旧容器(非常关键)
|
||
docker stop ollama-rc-bot
|
||
docker rm ollama-rc-bot
|
||
docker build --no-cache -t ollama-rc-bot .
|
||
docker run -d --name ollama-rc-bot -p 5100:5005 ollama-rc-bot
|
||
|
||
② 重新 build 镜像(必须)
|
||
docker build --no-cache -t ollama-rc-bot .
|
||
③ 重新启动容器
|
||
docker run -d --name ollama-rc-bot -p 5100:5005 ollama-rc-bot
|
||
④ 看日志,确认新代码真的在跑
|
||
docker logs -f ollama-rc-bot
|
||
|
||
--------------------
|
||
先实时跟日志(非常重要)
|
||
docker logs -f ollama-rc-bot
|
||
再开一个窗口,重新 curl 一次
|
||
curl -X POST http://127.0.0.1:5100/ollama \
|
||
-H "Content-Type: application/json" \
|
||
-d '{
|
||
"text": "@ai 下午三点开会",
|
||
"channel_id": "#Room"
|
||
}'
|