main.py 972 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # File : main.py
  4. # Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
  5. # Author's Blog: https://blog.csdn.net/qq_32394351
  6. # Date : 2023/12/3
  7. from core.config import settings
  8. from core import server
  9. try:
  10. import pyjion
  11. pyjion.enable()
  12. print(f'pyjion即时编译功能已启用')
  13. except ImportError as e:
  14. pass
  15. # print(f'pyjion即时编译启用失败:{e}')
  16. app = server.InitializeApp()
  17. if __name__ == '__main__':
  18. import uvicorn
  19. # Don't set debug/reload equals True in release, because TimedRotatingFileHandler can't support multi-prcoess
  20. # 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
  21. uvicorn.run(
  22. app='main:app',
  23. host=str(settings.HOST),
  24. port=settings.PORT,
  25. reload=settings.RELOAD,
  26. log_config=str(settings.LOGGING_CONFIG_FILE)
  27. )