Skip to content

AIqcwh/FastAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

application_center_api

This is a web application built with FastAPI and managed with Poetry. It provides a RESTful API for managing resources.

Features

  • 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.

Requirements

  • Python 3.10+
  • Poetry

Installation

  1. Clone the repository:

    git clone git@github.com:cocorobo-base/application_center_api.git
    cd application_center_api
  2. 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
  1. 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

Running the Application

Using Uvicorn directly

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

Using PM2 for process management

You can also use PM2 to manage the application processes:

pm2 start start_service.sh --name application_center_api-dev -- dev

Documentation

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

FastAPI框架构建的python后端项目

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published