12345678910111213141516171819202122232425262728293031 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- """
- @Contact : liuyuqi.gov@msn.cn
- @Time : 2024/07/26
- @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
- @Desc : enter point
- """
- from apps import create_app
- app = create_app()
- if __name__=='__main__':
- from dotenv import load_dotenv
- import os
- if os.path.exists('.env'):
- load_dotenv('.env')
- _host = os.getenv("HOST") if os.getenv("HOST") is not None else "0.0.0.0"
- _port =os.getenv("PORT") if os.getenv("PORT") is not None else "8080"
- _debug=os.getenv("DEBUG") if os.getenv("DEBUG") is not None else True
- if _debug:
- app.run(host=_host, port=_port, debug=_debug)
- else :
- import uvicorn
- from asgiref.wsgi import WsgiToAsgi
- asgi_app = WsgiToAsgi(app)
- uvicorn.run(asgi_app, host=_host, port=_port,)
|