Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 推送到Heroku后应用程序不工作_Python_Git_Heroku_Bottle - Fatal编程技术网

Python 推送到Heroku后应用程序不工作

Python 推送到Heroku后应用程序不工作,python,git,heroku,bottle,Python,Git,Heroku,Bottle,我将我的应用程序部署到Heroku,但它没有运行 这是git push heroku master命令的输出: -----> Python app detected -----> Using Python runtime (python-2.7.8) -----> Installing dependencies using Pip (1.5.6) Cleaning up... -----> Discovering process types P

我将我的应用程序部署到Heroku,但它没有运行

这是git push heroku master命令的输出:

-----> Python app detected
-----> Using Python runtime (python-2.7.8)
-----> Installing dependencies using Pip (1.5.6)
       Cleaning up...
-----> Discovering process types
       Procfile declares types -> web

-----> Compressing... done, 37.6MB
-----> Launching... done, v5
       http://xxxxx.herokuapp.com/ deployed to Heroku

To git@heroku.com:xxxxx.git
   46ff457..1712c4b  master -> master
我的文件的内容:

web: python main.py
My main.py:

import bottle
import os

@bottle.route("/request")
def tryquestion():
 return '''
    <form action="/request" method="post">
        Enter you request: <input name="request" type="text" size="65" />
        <input value="Search" type="submit" />
     </form>
    '''

@bottle.route("/request", method="POST")
def answerq():
    q = request.forms.get('request')

    ##### my code #####


bottle.run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)))

检查日志后,它会在导入请求时出错。我将请求添加到需求文件中,应用程序已启动并运行


感谢大家帮助heroku运行瓶子应用程序,您需要这些规范

第一个文件添加这个

web:python./main.py$PORT


并确保您已将需求文件添加到那里。

输出中没有显示明显错误。但是,一个只运行任意脚本而不启动框架的Procfile是相当不寻常的。你能解释一下main.py应该做什么以及为什么你认为它不工作吗?我的main.py正在我的本地上工作,但是当我在heroku上部署应用程序时,网站没有运行。不运行意味着什么?当你浏览网站时会发生什么?HTTP 500?你查看过你的日志吗?当我浏览网站时,我发现应用程序错误:应用程序中发生错误,无法提供你的页面。请稍后再试。如果您是应用程序所有者,请查看日志以了解详细信息main,main.py具体做什么,以及它在本地以什么方式工作?当您导航到xxxx.herokuapp.com/request时,您预计会发生什么?为什么您预计会发生这种情况?我按照您的建议更改了程序文件,我的需求文件中已经有瓶子,但没有任何更改,我在运行应用程序时仍会出现应用程序错误检查日志后,它会在导入请求时出错。我将请求添加到需求文件中,应用程序已启动并运行。谢谢你的指导
2014-07-15T16:24:45.361567+00:00 app[web.1]: Traceback (most recent call last):
2014-07-15T16:24:45.361592+00:00 app[web.1]:     from umbc2 import sss
2014-07-15T16:24:45.361599+00:00 app[web.1]:     from requests import get
2014-07-15T16:24:45.361641+00:00 app[web.1]: ImportError: No module named reques
ts
2014-07-15T16:24:46.801880+00:00 heroku[web.1]: State changed from starting to c
rashed
2014-07-15T16:24:46.791054+00:00 heroku[web.1]: Process exited with status 1
2014-07-15T19:32:07.105615+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=xxxx.herokuapp.com request_id=d9d90a2b-8367
-4b3d-94b8-aecf5c2700a8 fwd="99.231.120.219" dyno= connect= service= status=503
bytes=
2014-07-15T19:32:07.254940+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=xxxx.herokuapp.com request_id=f3
0601cc-9703-494e-83ff-7ea3b95aea81 fwd="99.231.120.219" dyno= connect= service=
status=503 bytes=
2014-07-15T19:32:07.304050+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=xxxx.herokuapp.com request_id=cd
1ff90b-6644-4f79-b0fc-745f0480c3b7 fwd="99.231.120.219" dyno= connect= service=
status=503 bytes=
2014-07-15T19:32:26.459193+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/result" host=xxxx.herokuapp.com request_id=93a8d94
9-8f1b-4f1b-ad00-a1cbf8167bef fwd="99.231.120.219" dyno= connect= service= statu
s=503 bytes=