Linux 在heroku中启动应用程序?什么是程序文件?“网络:”命令?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18670186/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Launching an app in heroku? What is procfile? 'web:' command?
提问by druuu
I was referring to this site as i am learning python/flask and trying to use heroku.
我指的是这个网站,因为我正在学习 python/flask 并尝试使用 heroku。
http://ryaneshea.com/lightweight-python-apps-with-flask-twitter-bootstrap-and-heroku
http://ryaneshea.com/lightweight-python-apps-with-flask-twitter-bootstrap-and-heroku
Let me explain what all I did, so that any one who is stuck like me can get the picture. I am using Linux Backtrack command line . 1. I started virtualenv and then installed flask virtualenv --distribute pip install flask
让我解释一下我所做的一切,以便任何像我一样被卡住的人都可以得到图片。我正在使用 Linux Backtrack 命令行 。1.我启动了virtualenv,然后安装了flask virtualenv --distribute pip install flask
Then, connected heroku and github, created a repo also in the github. Wrote a simple script and saved it in app.py
然后,连接heroku和github,也在github中创建了一个repo。写了一个简单的脚本并保存在app.py中
Then, asked to create a procfile! web: python app.py
然后,要求创建一个procfile!网络:python app.py
Questions. 1. What is procfile in layman terms? 2. When i type web: python app.py, it says 'web:: command not found'
问题。1. 外行的 procfile 是什么?2. 当我输入 web: python app.py 时,它说'web:: command not found'
Please elaborate how this works?
请详细说明这是如何工作的?
I have one more doubt, sudo is supreme user right? We are not supposed to use it in virtualenv? And for what exactly are we using virtualenv? A simple example.
我还有一个疑问,sudo 是最高用户对吗?我们不应该在virtualenv中使用它吗?我们究竟是为了什么而使用 virtualenv?一个简单的例子。
Questions are pretty basic. DO bare.
问题很基本。做裸体。
回答by John Beynon
the Procfile tells Heroku what commands should be run (https://devcenter.heroku.com/articles/procfile).
Procfile 告诉 Heroku 应该运行哪些命令(https://devcenter.heroku.com/articles/procfile)。
You are able to define difference process types, such as web (the only one which will autostart by default), workers, etc...
您可以定义不同的进程类型,例如 web(默认情况下唯一会自动启动的一种)、worker 等...
So basically a Procfile containing
所以基本上是一个包含
web: python app.py
is telling Heroku to started a named process called web, and to run python app.py
when it starts.
告诉 Heroku 启动一个名为 web 的命名进程,并python app.py
在它启动时运行。
There is Python specific documentation for Heroku at https://devcenter.heroku.com/articles/getting-started-with-python#declare-process-types-with-procfile
在https://devcenter.heroku.com/articles/getting-started-with-python#declare-process-types-with-procfile 上有 Heroku 的 Python 特定文档