This is a web application built with FastAPI and managed with Poetry. It provides a RESTful API for managing resources.
- FastAPI: A modern, fast (high-performance) web framework for building APIs with Python 3.7+.
- Poetry: Dependency management and packaging made easy.
- Automatic interactive API documentation: Provided by Swagger UI and ReDoc.
- Python 3.10+
- Poetry
-
Clone the repository:
git clone git@github.com:cocorobo-base/application_center_api.git cd application_center_api -
Install dependencies using Poetry:
Ensure you have Poetry installed. If not, you can install it via:
curl -sSL https://install.python-poetry.org | python3 -Then, install the dependencies:
poetry install
- Set up environment variables:
Create a .env.dev, .env.test, or .env.prod file based on your environment needs. Example:
# .env.dev
# -------- 数据库配置 --------
DB_HOST=xxxxx
DB_PORT=xxxxx
DB_USER=xxxxx
DB_PASSWORD=xxxxx
DB_DATABASE=xxxxx
# -------- 接口文档启用配置 --------
open_docs=true
open_redoc=False
You can run the application using Uvicorn through Poetry:
export ENV_FILE=".env.dev"
source $ENV_FILE;
poetry run uvicorn main:app --reload --host 0.0.0.0 --port 8000
You can also use PM2 to manage the application processes:
pm2 start start_service.sh --name application_center_api-dev -- dev
The API documentation is automatically generated and available at /docs (Swagger UI) and /redoc (ReDoc) when running the application if open_docs=True and open_redoc=True.
This project is licensed under the MIT License - see the LICENSE file for details.