我正在学习 Django 入门系列,但在使用 Heroku 时遇到了问题。
我已经一次又一次地完成这些步骤,在设置了 Virtualenv 的提供的虚拟机中运行。当我执行 git push heroku master 时,我得到以下输出:
(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ git push heroku master
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (11/11), 3.61 KiB, done.
Total 11 (delta 0), reused 0 (delta 0)
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.3.
-----> Preparing Python runtime (python-2.7.3)
-----> Installing Distribute (0.6.34)
-----> Installing Pip (1.2.1)
-----> Installing dependencies using Pip (1.2.1)
Downloading/unpacking Django==1.4.3 (from -r requirements.txt (line 1))
Running setup.py egg_info for package Django
Downloading/unpacking argparse==1.2.1 (from -r requirements.txt (line 2))
Running setup.py egg_info for package argparse
no previously-included directories found matching 'doc/_build'
no previously-included directories found matching 'env24'
no previously-included directories found matching 'env25'
no previously-included directories found matching 'env26'
no previously-included directories found matching 'env27'
Installing collected packages: Django, argparse
Running setup.py install for Django
changing mode of build/scripts-2.7/django-admin.py from 600 to 755
changing mode of /app/.heroku/python/bin/django-admin.py to 755
Running setup.py install for argparse
no previously-included directories found matching 'doc/_build'
no previously-included directories found matching 'env24'
no previously-included directories found matching 'env25'
no previously-included directories found matching 'env26'
no previously-included directories found matching 'env27'
Successfully installed Django argparse
Cleaning up...
-----> Collecting static files
0 static files copied.
-----> Discovering process types
! This format of Procfile is unsupported
! Use a colon to separate the process name from the command
! e.g. python: manage.py runserver 0.0.0.0:$PORT .noreload
! Heroku push rejected, malformed Procfile
To <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="13747a67537b76617c78663d707c7e" rel="noreferrer noopener nofollow">[email protected]</a>:quiet-lowlands-3777.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1b7c726f5b737e6974706e35787476" rel="noreferrer noopener nofollow">[email protected]</a>:quiet-lowlands-3777.git'
(blog-venv)vagrant@precise64:/vagrant/projects/microblog$ cat Procfile
python: manage.py runserver 0.0.0.0:$PORT --noreload
我有点绝望了,有人能解释一下吗?谷歌等已经完成。
最佳答案
现在已经弄清楚了,教程:http://gettingstartedwithdjango.com关于此事尚不清楚。 Procfile 的内容应该是:
网络:python manage.py runserver 0.0.0.0:$PORT --noreload
不是
python manage.py runserver 0.0.0.0:$PORT --noreload
留下这个问题以供其他人将来引用。
关于Heroku 格式错误的 Procfile(使用他们自己的示例),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14541226/