当我尝试部署到GAE时,请使用:
gcloud app deploy
在cmd行中的,在构建过程中过了几分钟后它出错。 我可以在Mac(mojave 10.14.3)上本地运行-可以在本地运行 在本地,我将python 3.6和最新的pip(19.1.1)用于软件包
gcloud实例是运行python 2.7或3.6的Ubuntu计算机。 在我的app.yaml配置文件中,我设置为python 3。
app.yaml文件为:
runtime: python
env: flex
entrypoint: gunicorn app:app.server -b :$PORT
threadsafe: false
runtime_config:
python_version: 2
resources:
cpu: 1
memory_gb: 1
disk_size_gb: 10
requirements.txt文件为:
dash==0.21.0
dash-core-components==0.22.1
dash-html-components==0.10.0
dash-renderer==0.12.1
Flask==0.12
pandas==0.22.0
plotly==2.5.1
gunicorn==19.9.0
flask_login==0.4.1
flask_sqlalchemy==2.4.0
configparser==3.7.4
arrow==0.14.2
dash-daq==0.1.5
sqlalchemy==1.3.4
scipy==0.17.0
numpy==1.16.4
pillow==6.0.0
dash_daq==0.1.5
certifi==2019.3.9
retrying==1.3.3
urllib3==1.25.3
requests==2.22.0
我基本上已经尝试了一切!从将我的本地切换到python 2.7和云配置。
app.yaml配置的所有组合。我修复了出现的所有程序包错误。
我可能希望,可能是我需要通过.Dockerfile进行自定义环境构建。但尚不清楚到底需要什么定制。每次尝试都需要几分钟才能尝试部署它,这也令人沮丧。.(有关提高速度的任何建议?)
我的“主”(app.py)文件:
# index page
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import sys
#sys.path.append('/Users/crowledj/Mindfule/dash-flask-login/views/')
#sys.path.append('/Users/crowledj/Mindfule/dash-flask-login/flask_login/')
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
#server=app.server
#app.css.append_css({'external_url': 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css'})
from server import app, server
from flask_login import logout_user, current_user
import success, login, login_fd, logout
对于import,要实际运行的最后一行是:
if __name__ == '__main__':
app.run_server(debug= False,port=8080,host= "foodmoodai.appspot.com")
我的主要应用代码文件的导入:
import dash
#import dash_auth
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_daq as daq
import plotly.graph_objs as go
from textwrap import dedent as d
from flask import Flask
import pandas as pd
import numpy as np
from NutrientParser import parseNutrientStr_frmUser,parseResearch,parseFoodResearch,find_substring
from userMindfuleClasses import *
#import time
#import dash_table as dtable
#import base64
import PIL
import urllib3
from PIL import Image
import json,os
import arrow
from server import app
构建日志中的主要错误是scipy构建失败...:
Step #1: Running setup.py bdist_wheel for scipy: started
Step #1: Running setup.py bdist_wheel for scipy: finished with status 'error'
Step #1: Complete output from command /env/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-m9tl_bsf/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-db6mbz4m --python-tag cp36:
Step #1: Traceback (most recent call last):
Step #1: File "<string>", line 1, in <module>
Step #1: File "/tmp/pip-install-m9tl_bsf/scipy/setup.py", line 265, in <module>
Step #1: setup_package()
Step #1: File "/tmp/pip-install-m9tl_bsf/scipy/setup.py", line 253, in setup_package
Step #1: from numpy.distutils.core import setup
Step #1: ModuleNotFoundError: No module named 'numpy'
Step #1:
Step #1: ----------------------------------------
Step #1: Failed building wheel for scipy
Step #1: Running setup.py clean for scipy
完整的错误日志中还有另一个线索。
它还表示我在该实例上有一个较旧的pip版本,并且存在一个更新得多的版本。该怎么做-即在实例上更新?!
顺便说一句-我检查了登录,我的应用引擎控制台及其相同的详细信息:(