123456789101112131415161718192021222324252627282930313233 |
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- # File : main.py
- # Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
- # Author's Blog: https://blog.csdn.net/qq_32394351
- # Date : 2023/12/3
- from core.config import settings
- from core import server
- try:
- import pyjion
- pyjion.enable()
- print(f'pyjion即时编译功能已启用')
- except ImportError as e:
- pass
- # print(f'pyjion即时编译启用失败:{e}')
- app = server.InitializeApp()
- if __name__ == '__main__':
- import uvicorn
- # Don't set debug/reload equals True in release, because TimedRotatingFileHandler can't support multi-prcoess
- # please used "uvicorn --host 127.0.0.1 --port 8000 main:app --env-file ./configs/.env" run in release, and used "python main.py" in dev
- uvicorn.run(
- app='main:app',
- host=str(settings.HOST),
- port=settings.PORT,
- reload=settings.RELOAD,
- log_config=str(settings.LOGGING_CONFIG_FILE)
- )
|