【发布时间】:2017-07-03 15:50:52
【问题描述】:
我是 Flask 的新手,如果问题听起来微不足道,请不要介意。 我有一个 Flask 应用程序(不是我编写的),当我直接连接到网络时,它可以在本地机器和远程机器上正常工作。
但是当我通过 VPN 连接到应用程序时,它不起作用。我能够在该机器上 ssh 以及访问在同一台机器上运行的其他服务器。它是物理机,而不是虚拟机
app = Flask(__name__)
def loadAppVariables():
mc = pylibmc.Client(["127.0.0.1"], binary=True,
behaviors={"tcp_nodelay": True,
"ketama": True});
app.mc=mc
def initApp():
app.fNet= {some object }
mc = pylibmc.Client(["127.0.0.1"], binary=True,
behaviors={"tcp_nodelay": True,
"ketama": True});
app.mc=mc;
@app.route('/classify', methods=['POST'])
def classify():
# We will save the file to disk for possible data collection.
imagefile = request.files['imagefile']
processImageFile(imagefile)
@app.route('/')
def index():
return render_template('cindex.html', has_result=False)
@app.before_request
def before_request():
loadAppVariables()
@app.teardown_request
def teardown_request(exception):
storeAppVariables()
if __name__ == '__main__':
initApp();
app.run(debug=False,host='0.0.0.0')
我正在运行最新的 Flask 版本和 python 2.7。谁能建议这里可能有什么问题?
【问题讨论】: