首次尝试将Flask应用程序上传到heroku时出现Applicationerror

时间:2020-04-04 19:28:40

标签: python git flask heroku

我一直试图将我创建的烧瓶应用程序上载到heroku服务器。当我尝试运行该应用程序时收到此消息。我还是这个新手。

我正在使用Win10电脑, 使用python 3和 安装了conda env

应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请检查日志以获取详细信息。您可以使用以下命令从Heroku CLI执行此操作 heroku日志--tail

检查日志后,我得到了

20-04-04T18:51:29.486263+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-04-04T18:51:29.486263+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
2020-04-04T18:51:29.486382+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2020-04-04T18:51:29.486687+00:00 app[web.1]: [2020-04-04 18:51:29 +0000] [11] [INFO] Worker exiting (pid: 11)
2020-04-04T18:51:29.599281+00:00 app[web.1]: [2020-04-04 18:51:29 +0000] [4] [INFO] Shutting down: Master
2020-04-04T18:51:29.599441+00:00 app[web.1]: [2020-04-04 18:51:29 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-04-04T19:00:27.000000+00:00 app[api]: Build started by user tbmakusha@gmail.com
2020-04-04T19:05:27.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/8e82c830-7360-4f12-8ba2-d1fd084f25f0/activity/builds/5c420c44-b2f6-421e-bce1-d91a283787e4
2020-04-04T19:16:40.808626+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/about/" host=takuonline.herokuapp.com request_id=ae9c0c3b-f507-403f-b127-83b8f74cd87b fwd="197.229.0.248" dyno= connect= service= status=503 bytes= protocol=http

我意识到我最初的req.txt文件并没有我需要的所有模块,所以我尝试使用其他模块,但是我遇到了这个错误

remote:            Running setup.py install for pyodbc: started
remote:            Running setup.py install for pyodbc: finished with status 'error'
remote:            ERROR: Command errored out with exit status 1:
remote:             command: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bn8zgjtt/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bn8zgjtt/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ns1t96ec/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/pyodbc
remote:                 cwd: /tmp/pip-install-bn8zgjtt/pyodbc/
remote:            Complete output (16 lines):
remote:            /app/.heroku/python/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
remote:              warnings.warn(msg)
remote:            running install
remote:            running build
remote:            running build_ext
remote:            building 'pyodbc' extension
remote:            creating build
remote:            creating build/temp.linux-x86_64-3.6
remote:            creating build/temp.linux-x86_64-3.6/src
remote:            gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.30 -I/app/.heroku/python/include/python3.6m -c src/buffer.cpp -o build/temp.linux-x86_64-3.6/src/buffer.o -Wno-write-strings
remote:            In file included from src/buffer.cpp:12:0:
remote:            src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
remote:             #include <sql.h>
remote:                      ^~~~~~~
remote:            compilation terminated.
remote:            error: command 'gcc' failed with exit status 1
remote:            ----------------------------------------
remote:        ERROR: Command errored out with exit status 1: /app/.heroku/python/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bn8zgjtt/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bn8zgjtt/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ns1t96ec/install-record.txt --single-version-externally-managed --compile --install-headers /app/.heroku/python/include/python3.6m/pyodbc Check the logs for full command output.
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to takuonline.
remote:
To https://git.heroku.com/takuonline.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/takuonline.git'

0 个答案:

没有答案