mkdir /root/code && cd /root/code
git clone https://github.com/Winspain/ai-admin.git
vim ai-admin/.env # add mysql password
cd ai-admin/src
pip install -r requirements/base.txt
nohup /usr/local/bin/python3 main.py > /root/code/ai-admin/src/logfile.log 2>&1 &
nohup /usr/local/bin/python3 main.py > /dev/null 2>&1 &
- Store all domain directories inside
src
foldersrc/
- highest level of an app, contains common models, configs, and constants, etc.src/main.py
- root of the project, which inits the FastAPI app
- Each package has its own router, schemas, models, etc.
router.py
- is a core of each module with all the endpointsschemas.py
- for pydantic modelsmodels.py
- for db modelsservice.py
- module specific business logicdependencies.py
- router dependenciesconstants.py
- module specific constants and error codesconfig.py
- e.g. env varsutils.py
- non-business logic functions, e.g. response normalization, data enrichment, etc.exceptions.py
- module specific exceptions, e.g.PostNotFound
,InvalidUserData
- When package requires services or dependencies or constants from other packages - import them with an explicit module name