PyApi
BD7JDU BH7QZX
Base FastAPI Model to build.
Feature
Document
Reference
Development
>= Python3.8 Env
Build Virtual Environment ref
windows:
python -m venv ./venv
# Open Powershell Limited
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Activate
.\venv\Scripts\Activate.ps1
# pip
pip install -r requirements.txt
# Eitx
deactivate Install modul by pip
pip install "fastapi[all]"
pip install "uvicorn[standard]"Run Application
uvicorn main:app --reloador..
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)run with docker
git clone https://github.com/WhaleFell/PyAPI.git
cd PyAPI
docker build -t my .
docker run -d --name PyAPI -p 8000:80 my
# 可更新代码
docker run -d --name PyAPI \
-v /root/PyAPI:/app/ \
-p 8000:80 \
my
docker restart PyAPIrun with uvicorn or Gunicorn
uvicorn main:app --host 0.0.0.0 --port 8080 --workers 4
# or..
# pip install gunicorn
gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:80Develop with Git
# create dev branch
git branch dev
# checkout dev
git checkout dev
git checkout main
git checkout mainmerge branch ignore some file
git config merge.ours.driver true
# .gitattributes
README.md merge=ours
git checkout main
git merge devreferent
ASGI (Asynchronous [eɪˈsɪŋkrənəs] Server Gateway Interface) 异步服务器网关接口
WSGI (Web Server Gateway Interface) 网站服务器网关接口
On this page
Languages
JavaScript64.2%Python28.6%HTML6.9%Dockerfile0.3%
Contributors
Created July 29, 2023
Updated August 14, 2025