iT邦幫忙

0

GCP 上 App Engine 設定 flask_appbuilder

先看 log

2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,630:INFO:flask_appbuilder.base:Registering class PermissionViewModelView on menu Permission on Views/Menus
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,630:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/download/<string:filename> ('GET',)
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,630:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/edit/<pk> ['GET', 'POST']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/list/ ('GET',)
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/show/<pk> ['GET']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/action/<string:name>/<pk> ['GET', 'POST']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/action_post ['POST']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/add ['GET', 'POST']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/api ['GET']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/api/column/add/<col_name> ['GET']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/api/column/edit/<col_name> ['GET']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/api/create ['POST']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/api/delete/<pk> ['DELETE']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/api/get/<pk> ['GET']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/api/read ['GET']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/api/readvalues ['GET']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/api/update/<pk> ['PUT']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/delete/<pk> ['GET', 'POST']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/download/<string:filename> ('GET',)
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/edit/<pk> ['GET', 'POST']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/list/ ('GET',)
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,631:INFO:flask_appbuilder.baseviews:Registering route /permissionviews/show/<pk> ['GET']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,665:INFO:flask_appbuilder.base:Registering class MenuApi on menu
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,665:INFO:flask_appbuilder.base:Registering class MenuApi on menu
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,665:INFO:flask_appbuilder.api:Registering route /api/v1/menu/ ['GET']
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,665:INFO:flask_appbuilder.api:Registering route /api/v1/menu/ ['GET']
2020-12-08 11:45:22 default[20201208t114331]   * Serving Flask app "app" (lazy loading)
2020-12-08 11:45:22 default[20201208t114331]   * Environment: production
2020-12-08 11:45:22 default[20201208t114331]     WARNING: This is a development server. Do not use it in a production deployment.
2020-12-08 11:45:22 default[20201208t114331]     Use a production WSGI server instead.
2020-12-08 11:45:22 default[20201208t114331]   * Debug mode: on
2020-12-08 11:45:22 default[20201208t114331]   * Serving Flask app "app" (lazy loading)
2020-12-08 11:45:22 default[20201208t114331]   * Environment: production
2020-12-08 11:45:22 default[20201208t114331]     WARNING: This is a development server. Do not use it in a production deployment.
2020-12-08 11:45:22 default[20201208t114331]     Use a production WSGI server instead.
2020-12-08 11:45:22 default[20201208t114331]   * Debug mode: on
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,791:INFO:werkzeug: * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)
2020-12-08 11:45:22 default[20201208t114331]  [2020-12-08 11:45:22 +0000] [23] [ERROR] Exception in worker process
2020-12-08 11:45:22 default[20201208t114331]  Traceback (most recent call last):    File "/layers/google.python.webserver/gunicorn/gunicorn/arbiter.py", line 583, in spawn_worker      worker.init_process()    File "/layers/google.python.webserver/gunicorn/gunicorn/workers/gthread.py", line 92, in init_process      super().init_process()    File "/layers/google.python.webserver/gunicorn/gunicorn/workers/base.py", line 119, in init_process      self.load_wsgi()    File "/layers/google.python.webserver/gunicorn/gunicorn/workers/base.py", line 144, in load_wsgi      self.wsgi = self.app.wsgi()    File "/layers/google.python.webserver/gunicorn/gunicorn/app/base.py", line 67, in wsgi      self.callable = self.load()    File "/layers/google.python.webserver/gunicorn/gunicorn/app/wsgiapp.py", line 49, in load      return self.load_wsgiapp()    File "/layers/google.python.webserver/gunicorn/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp      return util.import_app(self.app_uri)    File "/layers/google.python.webserver/gunicorn/gunicorn/util.py", line 358, in import_app      mod = importlib.import_module(module)    File "/opt/python3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module      return _bootstrap._gcd_import(name[level:], package, level)    File "<frozen importlib._bootstrap>", line 1014, in _gcd_import    File "<frozen importlib._bootstrap>", line 991, in _find_and_load    File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked    File "<frozen importlib._bootstrap>", line 671, in _load_unlocked    File "<frozen importlib._bootstrap_external>", line 783, in exec_module    File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed    File "/srv/main.py", line 3, in <module>      app.run(host='127.0.0.1', port=8080, debug=True)    File "/layers/google.python.pip/pip/flask/app.py", line 990, in run      run_simple(host, port, self, **options)    File "/layers/google.python.pip/pip/werkzeug/serving.py", line 1030, in run_simple      s.bind(server_address)  OSError: [Errno 98] Address already in use
2020-12-08 11:45:22 default[20201208t114331]  [2020-12-08 11:45:22 +0000] [23] [INFO] Worker exiting (pid: 23)
2020-12-08 11:45:22 default[20201208t114331]  2020-12-08 11:45:22,804:INFO:werkzeug: * Restarting with stat
2020-12-08 11:45:22 default[20201208t114331]  [2020-12-08 11:45:22 +0000] [21] [INFO] Worker exiting (pid: 21)
2020-12-08 11:45:23 default[20201208t114331]  [2020-12-08 11:45:23 +0000] [10] [INFO] Shutting down: Master
2020-12-08 11:45:23 default[20201208t114331]  [2020-12-08 11:45:23 +0000] [10] [INFO] Reason: Worker failed to boot

起不來 ... 要如何設定
flask 與 django 設定沒問題 (參考 google 範例)

但 flask_appbuilder 搞不定

當然用VM linux 可搞定 ....但我想試試 App Engine .....

echochio iT邦高手 1 級 ‧ 2020-12-10 10:26:57 檢舉
已解決 ..... 原來requirements.txt 要加 uwsgi
當初搞不懂 App Engine 機制, 現在大約搞懂了

尚未有邦友回答

立即登入回答