From 95f5521af5ea297b1d4bd53dbb4a612ffdfbbc3b Mon Sep 17 00:00:00 2001 From: MarkusJoe Date: Sun, 24 Apr 2022 21:32:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=85=8D=E7=BD=AE=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=BB=8E=E9=BB=98=E8=AE=A4=E4=BF=AE=E6=94=B9=E4=B8=BA=E4=BA=86?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E6=9D=A5?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manage.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/manage.py b/manage.py index aa51357..ee979dc 100644 --- a/manage.py +++ b/manage.py @@ -6,20 +6,22 @@ # @File Name: manage.py +import os from app import create_app -app = create_app('default') + +config = os.getenv('FLASK_CONFIG') or os.getenv('DYNO') or 'default' +app = create_app(config) if __name__ == '__main__': - from app import logger from gevent import pywsgi - logger.info('服务运行在 http://127.0.0.1:5000') + app.logger.info('服务运行在 http://127.0.0.1:5000') try: server = pywsgi.WSGIServer(('0.0.0.0', 5000), app) server.serve_forever() except KeyboardInterrupt: - logger.info('已退出') + app.logger.info('已退出') except OSError: - logger.critical('5000 端口已被占用') + app.logger.critical('5000 端口已被占用') exit(1)