fullstack fastapi vuejs price aggregator
1.0.0
英國超市價格聚合器透過網路抓取。這是為我的大學專案作為 MVP 開發的,因此有些方面無法正常運作。我將來可能會更新它。
確保已安裝 Docker 和 Node.js。
docker-compose up --build -d
。啟動後端,並在第一次運行時建立所有必要的容器,這可能需要幾分鐘的時間。docker-compose exec backend bash
取得 shell。python manage.py createdb
。python manage.py seeddb
請注意,所有密碼均設定為密碼cd
進入客戶端目錄運行npm install
這將安裝所需的節點模組。npm run serve
它將為客戶端前端提供服務。 網址 | 描述 |
---|---|
0.0.0.0:8000/api | 後端 JSON API |
0.0.0.0:8000/文檔 | 後端 OpenAPI/Swagger 產生的 API 參考文檔 |
0.0.0.0:8000/redoc | ReDoc 提供的替代互動式文檔 |
本地主機:9527 | 前端 VueJS 單頁應用程式 |
後端包括一個 CLI,其很大程度上是受到 Netflix 的 Dispatch 的啟發。
typer
(與 FastAPI 是同一作者)用於為專案建立 CLI,並透過 manage.py 存取。
要執行命令,您需要在後端容器內執行一個 shell:
docker-compose run backend bash
若要查看所有可用命令:
root@72293bee6b37:/app# python manage.py
Usage: manage.py [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
config Display application configuration.
createdb Creates an empty database.
createrole Add role to database.
createuser Create new user in the database.
develop Start a development server with reload.
dropdb Drop the existing database.
routes Display application routes and dependencies.
seeddb Add fake data to database.
shell Starts an interactive shell with app object imported.
root@72293bee6b37:/app# python manage.py routes
Application Endpoints
Path Methods Dependencies
----------------------------- --------- --------------------------------------------------------
/api/v1/users/ GET ['RoleChecker: Roles: admin,user']
/api/v1/users/ POST ['RoleChecker: Roles: admin,user']
/api/v1/users/{id} GET ['RoleChecker: Roles: admin,user']
/api/v1/users/{id} PUT ['RoleChecker: Roles: admin,user']
/api/v1/users/{id} DELETE ['RoleChecker: Roles: admin,user']
/api/v1/users/{id}/roles GET ['RoleChecker: Roles: admin,user']
/api/v1/users/{id}/roles PUT ['RoleChecker: Roles: admin,user']
/api/v1/users/{id}/shops GET ['RoleChecker: Roles: admin,user']
/api/v1/users/{id}/shops PUT ['RoleChecker: Roles: admin,user']
/api/v1/roles/ GET ['RoleChecker: Roles: admin,user']
/api/v1/roles/ POST ['RoleChecker: Roles: admin,user']
/api/v1/roles/{id} GET ['RoleChecker: Roles: admin,user']
/api/v1/roles/{id} PUT ['RoleChecker: Roles: admin,user']
/api/v1/roles/{id} DELETE ['RoleChecker: Roles: admin,user']
/api/v1/shops/ GET ['RoleChecker: Roles: admin,user']
/api/v1/shops/ POST ['RoleChecker: Roles: admin,user']
/api/v1/shops/{id} PUT ['RoleChecker: Roles: admin,user']
/api/v1/shops/{id} DELETE ['RoleChecker: Roles: admin,user']
/api/v1/shops/listings/ GET ['RoleChecker: Roles: admin,user']
/api/healthcheck GET []
python manage.py config
Application Configuration
Setting Value(s)
-------------------------- --------------------------------------------------------------------
APP_DIR /app/app
STATIC_DIR /app/app/static
EMAIL_TEMPLATES_DIR /app/app/static/email-templates/html
PROJECT_NAME Fastapi Backend
SERVER_HOST 0.0.0.0
CORS_WHITELIST ['http://localhost', 'http://localhost:8000', 'http://0.0.0.0:8000']
FASTAPI_ENV development
DEBUG False
LOG_LEVEL debug
FIRST_SUPERUSER [email protected]
FIRST_SUPERUSER_PASSWORD a5dbf43e07f4d19e5b73bc89a8f74
USERS_OPEN_REGISTRATION True
SECRET_KEY **********
JWT_AUTH_LIFETIME_SECONDS 604800
JWT_EMAIL_LIFETIME_SECONDS 3600
SMTP_USER [email protected]
SMTP_PASSWORD **********
SMTP_TLS False
SMTP_SSL False
SMTP_HOST mailhog
SMTP_PORT 1025
POSTGRES_USER postgres
POSTGRES_PASSWORD **********
POSTGRES_HOST postgres
POSTGRES_PORT 5432
POSTGRES_DB fastapi_backend