Azure App Server中的烧瓶
你好
我正在尝试在Azure App Server上部署Flask项目.我遵循了官方指南,该指南在使用样品瓶项目时成功运行.
I am trying to deploy a flask project on Azure App Server. I have followed the official guide which worked successfully when using a sample flask project.
我有我自己的flask项目,该项目可以在计算机上本地完美运行.当我尝试在Azure上部署它时,我收到以下错误日志.我认为这可能与Azure Linux服务器和库的可用性有关.
I have my own flask project, which runs perfectly locally on my computer. When I try to deploy it on Azure, I get the following following error log. I believe this may have to do with the Azure Linux Server and the library availability.
2019-01-26T22:34:23 Welcome, you are now connected to log-streaming service.
2019-01-26T22:34:20.331135452Z
2019-01-26T22:34:20.331181753Z _____
2019-01-26T22:34:20.331188153Z / _ \ __________ _________ ____
2019-01-26T22:34:20.331192053Z / /_\ \___ / | \_ __ \_/ __ \
2019-01-26T22:34:20.331195853Z / | \/ /| | /| | \/\ ___/
2019-01-26T22:34:20.331199653Z \____|__ /_____ \____/ |__| \___ >
2019-01-26T22:34:20.331203453Z \/ \/ \/
2019-01-26T22:34:20.331207253Z
2019-01-26T22:34:20.331210553Z A P P S E R V I C E O N L I N U X
2019-01-26T22:34:20.331214053Z
2019-01-26T22:34:20.331217453Z Documentation: http://aka.ms/webapp-linux
2019-01-26T22:34:20.331221053Z
2019-01-26T22:34:20.739564167Z Starting OpenBSD Secure Shell server: sshd.
2019-01-26T22:34:20.797187397Z Running python /usr/local/bin/entrypoint.py
2019-01-26T22:34:21.054346173Z executing:
2019-01-26T22:34:21.054492773Z python --version
2019-01-26T22:34:21.074927019Z Python 3.7.1
2019-01-26T22:34:21.075079919Z executing:
2019-01-26T22:34:21.075200919Z pip --version
2019-01-26T22:34:24.945566790Z pip 10.0.1 from /home/site/wwwroot/antenv/lib/python3.7/site-packages/pip (python 3.7)
2019-01-26T22:34:24.959886222Z found flask app
2019-01-26T22:34:24.960399124Z executing:
2019-01-26T22:34:24.960509524Z . antenv/bin/activate
2019-01-26T22:34:24.969337544Z
2019-01-26T22:34:24.969526444Z executing:
2019-01-26T22:34:24.969647744Z GUNICORN_CMD_ARGS="--bind=0.0.0.0 --timeout 600" gunicorn app:app
2019-01-26T22:34:25.955266152Z [2019-01-26 22:34:25 +0000] [35] [INFO] Starting gunicorn 19.9.0
2019-01-26T22:34:25.956385255Z [2019-01-26 22:34:25 +0000] [35] [INFO] Listening at: http://0.0.0.0:8000 (35)
2019-01-26T22:34:25.956628655Z [2019-01-26 22:34:25 +0000] [35] [INFO] Using worker: sync
2019-01-26T22:34:25.967108279Z [2019-01-26 22:34:25 +0000] [38] [INFO] Booting worker with pid: 38
2019-01-26T22:34:31.286154295Z [2019-01-26 22:34:31 +0000] [38] [ERROR] Exception in worker process
2019-01-26T22:34:31.286179196Z Traceback (most recent call last):
2019-01-26T22:34:31.286183396Z File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2019-01-26T22:34:31.286188996Z worker.init_process()
2019-01-26T22:34:31.286192496Z File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
2019-01-26T22:34:31.286196096Z self.load_wsgi()
2019-01-26T22:34:31.286199396Z File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2019-01-26T22:34:31.286202996Z self.wsgi = self.app.wsgi()
2019-01-26T22:34:31.286213896Z File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2019-01-26T22:34:31.286217796Z self.callable = self.load()
2019-01-26T22:34:31.286221096Z File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2019-01-26T22:34:31.286224396Z return self.load_wsgiapp()
2019-01-26T22:34:31.286227796Z File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2019-01-26T22:34:31.286231196Z return util.import_app(self.app_uri)
2019-01-26T22:34:31.286234396Z File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
2019-01-26T22:34:31.286237796Z __import__(module)
2019-01-26T22:34:31.286241096Z File "/home/site/wwwroot/app.py", line 12, in <module>
2019-01-26T22:34:31.286244996Z import pyodbc
2019-01-26T22:34:31.286248196Z ImportError: libodbc.so.2: cannot open shared object file: No such file or directory
2019-01-26T22:34:31.286572596Z [2019-01-26 22:34:31 +0000] [38] [INFO] Worker exiting (pid: 38)
2019-01-26T22:34:31.421384098Z [2019-01-26 22:34:31 +0000] [35] [INFO] Shutting down: Master
2019-01-26T22:34:31.421588799Z [2019-01-26 22:34:31 +0000] [35] [INFO] Reason: Worker failed to boot.
2019-01-26T22:34:31.532032946Z
2019-01-26 22:34:32.507 ERROR - Container testnumber3_0 for site testnumber3 has exited, failing site start
2019-01-26 22:34:34.539 INFO - Starting container for site
2019-01-26 22:34:34.542 INFO - docker run -d -p 36997:8000 --name testnumber3_0 -e WEBSITE_SITE_NAME=testNumber3 -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=4e627c158a787ef098d2fc64fac1aa1045efbce9cf4366b0fb867333237b2444 appsvc/python:3.7_1811301405
2019-01-26 22:34:34.542 INFO - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2019-01-26T22:34:35.883529595Z
2019-01-26T22:34:35.883584395Z _____
2019-01-26T22:34:35.883589695Z / _ \ __________ _________ ____
2019-01-26T22:34:35.883593395Z / /_\ \___ / | \_ __ \_/ __ \
2019-01-26T22:34:35.883597195Z / | \/ /| | /| | \/\ ___/
2019-01-26T22:34:35.883600796Z \____|__ /_____ \____/ |__| \___ >
2019-01-26T22:34:35.883604696Z \/ \/ \/
2019-01-26T22:34:35.883608296Z
2019-01-26T22:34:35.883611696Z A P P S E R V I C E O N L I N U X
2019-01-26T22:34:35.883615196Z
2019-01-26T22:34:35.883618696Z Documentation: http://aka.ms/webapp-linux
2019-01-26T22:34:35.883622096Z
2019-01-26T22:34:36.058281587Z Starting OpenBSD Secure Shell server: sshd.
2019-01-26T22:34:36.079592835Z Running python /usr/local/bin/entrypoint.py
2019-01-26T22:34:36.204711115Z executing:
2019-01-26T22:34:36.204728415Z python --version
2019-01-26T22:34:36.207442321Z Python 3.7.1
2019-01-26T22:34:36.207584421Z executing:
2019-01-26T22:34:36.207693122Z pip --version
2019-01-26T22:34:38.938546840Z pip 10.0.1 from /home/site/wwwroot/antenv/lib/python3.7/site-packages/pip (python 3.7)
2019-01-26T22:34:38.954654776Z found flask app
2019-01-26T22:34:38.955657578Z executing:
2019-01-26T22:34:38.955787278Z . antenv/bin/activate
2019-01-26T22:34:38.975853723Z
2019-01-26T22:34:38.976014224Z executing:
2019-01-26T22:34:38.976132324Z GUNICORN_CMD_ARGS="--bind=0.0.0.0 --timeout 600" gunicorn app:app
2019-01-26T22:34:39.917566433Z [2019-01-26 22:34:39 +0000] [36] [INFO] Starting gunicorn 19.9.0
2019-01-26T22:34:39.923920247Z [2019-01-26 22:34:39 +0000] [36] [INFO] Listening at: http://0.0.0.0:8000 (36)
2019-01-26T22:34:39.924188048Z [2019-01-26 22:34:39 +0000] [36] [INFO] Using worker: sync
2019-01-26T22:34:39.934710872Z [2019-01-26 22:34:39 +0000] [39] [INFO] Booting worker with pid: 39
2019-01-26T22:34:45.284352457Z [2019-01-26 22:34:45 +0000] [39] [ERROR] Exception in worker process
2019-01-26T22:34:45.284378057Z Traceback (most recent call last):
2019-01-26T22:34:45.284382057Z File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2019-01-26T22:34:45.284396757Z worker.init_process()
2019-01-26T22:34:45.284400957Z File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
2019-01-26T22:34:45.284404457Z self.load_wsgi()
2019-01-26T22:34:45.284407757Z File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2019-01-26T22:34:45.284411157Z self.wsgi = self.app.wsgi()
2019-01-26T22:34:45.284422857Z File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2019-01-26T22:34:45.284426557Z self.callable = self.load()
2019-01-26T22:34:45.284429757Z File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2019-01-26T22:34:45.284433057Z return self.load_wsgiapp()
2019-01-26T22:34:45.284436357Z File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2019-01-26T22:34:45.284439657Z return util.import_app(self.app_uri)
2019-01-26T22:34:45.284442857Z File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
2019-01-26T22:34:45.284446157Z __import__(module)
2019-01-26T22:34:45.284449357Z File "/home/site/wwwroot/app.py", line 12, in <module>
2019-01-26T22:34:45.284453157Z import pyodbc
2019-01-26T22:34:45.284456357Z ImportError: libodbc.so.2: cannot open shared object file: No such file or directory
2019-01-26T22:34:45.284754558Z [2019-01-26 22:34:45 +0000] [39] [INFO] Worker exiting (pid: 39)
2019-01-26T22:34:45.417282055Z [2019-01-26 22:34:45 +0000] [36] [INFO] Shutting down: Master
2019-01-26T22:34:45.417295855Z [2019-01-26 22:34:45 +0000] [36] [INFO] Reason: Worker failed to boot.
2019-01-26T22:34:45.467395867Z
2019-01-26 22:34:46.506 ERROR - Container testnumber3_0 for site testnumber3 has exited, failing site start
突出显示,是的,如果您需要添加其他依赖项软件包,可以通过将软件包添加到源仓库中的requriments.txt中来使用pip install,请在以下位置查看示例
Just to highlight, yes if you need to add additional dependency packages, you could use pip install by adding the packages to the requriments.txt in your source repo, check out the sample at https://github.com/Azure-Samples/python-docs-hello-world/blob/master/requirements.txt.
请确保已按照本示例中的说明正确设置了启动脚本: https://github.com/Azure-App-Service/python/blob/master/3.7.0/entrypoint.py#L30
请参阅
获取有关此问题的更多详细信息.另外,请参见此讨论
,让我们知道如何进行进一步的调查.
Ensure that the startup script is appropriately set as mentioned in this sample:https://github.com/Azure-App-Service/python/blob/master/3.7.0/entrypoint.py#L30
See Troubleshooting
to fetch more details on this issue. Also, see this discussion
thread and let us know how it goes for further investigation.