作者:姓赵的妖女 | 来源:互联网 | 2022-12-21 10:39
IvebeenstrugglingtodeployaFlaskapplicationinOpenshift.Firstofall,Itriedtodeployan
I've been struggling to deploy a Flask application in Openshift. First of all, I tried to deploy an application I am developing. As I didn't succeed, I decided to create a sample Hello World and deploy it.
我一直在尝试在Openshift中部署一个Flask应用程序。首先,我尝试部署正在开发的应用程序。由于没有成功,我决定创建一个示例Hello World并部署它。
Here is the code of app.py
这是app.py的代码
from flask import Flask, render_templateapp = Flask(__name__)@app.route('/')def hello_world(): return render_template('index.html')if __name__ == '__main__': app.run()
I do use the install_requirements in setup.py file:
我在安装中确实使用了install_requirements。py文件:
from setuptools import setupsetup(name='SweetyPro', version='1.0', description='OpenShift App', author='Your Name', author_email='waglds@gmail.com', url='http://www.python.org/sigs/distutils-sig/', install_requires=['Django>=1.3', 'Flask==0.11.1'], )
I also set up flask and a requirement in requirements.txt. However, Openshift only says it is a Service Temporarily Unavailable.
我还在requirements.txt中设置了flask和一个需求。然而,Openshift只说它是暂时不可用的服务。
I checked out the log through rhc tail -a my_application, and it prompts me this:
我通过rhc tail -a my_application检出日志,它提示我:
==> app-root/logs/python.log <==Traceback (most recent call last): File "app.py", line 10, in app.run() File "/var/lib/openshift/57976d4c7628e1a34e000179/python/virtenv/lib/python2.7/site-packages/Flask-0.11.1-py2.7.egg/flask/app.py", line 843, in run run_simple(host, port, self, **options) File "/var/lib/openshift/57976d4c7628e1a34e000179/python/virtenv/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/serving.py", line 694, in run_simple inner() File "/var/lib/openshift/57976d4c7628e1a34e000179/python/virtenv/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/serving.py", line 656, in inner fd=fd) File "/var/lib/openshift/57976d4c7628e1a34e000179/python/virtenv/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/serving.py", line 550, in make_server passthrough_errors, ssl_context, fd=fd) File "/var/lib/openshift/57976d4c7628e1a34e000179/python/virtenv/lib/python2.7/site-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/serving.py", line 464, in __init__ HTTPServer.__init__(self, (host, int(port)), handler) File "/opt/rh/python27/root/usr/lib64/python2.7/SocketServer.py", line 419, in __init__ self.server_bind() File "/opt/rh/python27/root/usr/lib64/python2.7/BaseHTTPServer.py", line 108, in server_bind SocketServer.TCPServer.server_bind(self) File "/opt/rh/python27/root/usr/lib64/python2.7/SocketServer.py", line 430, in server_bind self.socket.bind(self.server_address) File "/opt/rh/python27/root/usr/lib64/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args)socket.error: [Errno 13] Permission denied
Could anyone help me out, please? I already did what I could. Thank you!
谁能帮我一下吗?我已经尽力了。谢谢你!
1 个解决方案