【问题标题】:Deploy Django project on heroku (python 3.4.3)在heroku(python 3.4.3)上部署Django项目
【发布时间】:2015-09-15 00:59:39
【问题描述】:

我正在逐步遵循this 的指导。除了我使用 python 3.4.3pyvenv 而不是 virtualenv。我已经安装了:

  • Python 3.4.3
  • Django 1.8.2
  • python-psycopg2
  • libpq 开发

我的步骤是:

  1. mkdir hellodjango && cd hellodjango
  2. pyvenv venv
  3. 源 venv/bin/activate
  4. pip install django-toolbelt(成功)
  5. django-admin.py startproject hellodjango .
  6. 已创建 Procfile(网站:gunicorn hellodjango.wsgi --log-file -)
  7. 工头启动(成功并在浏览器中检查正在运行的应用程序)
  8. 点冻结> requirements.txt
  9. 添加 runtime.txt (python-3.4.3)
  10. 按照指南填写 settings.pywsgi.py
  11. 初始化并提交 git repo
  12. heroku 创建(成功)
  13. git push heroku master(错误!)

所以 git push heroku master 说:

Counting objects: 14, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (14/14), 2.90 KiB | 0 bytes/s, done.
Total 14 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing runtime ( 
remote: python-3.4.3)
remote:  !     Requested runtime ( 
remote: python-3.4.3) is not available for this stack (cedar-14).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
remote: 
remote:  !     Push rejected, failed to compile Python app
remote: 
remote: Verifying deploy...
remote: 
remote: !       Push rejected to cryptic-thicket-7510.
remote: 
To https://git.heroku.com/cryptic-thicket-7510.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/cryptic-thicket-7510.git'

如您所见,主要错误是Requested runtime (remote: python-3.4.3) is not available for this stack (cedar-14).我做错了什么?

【问题讨论】:

  • 将 runtime.txt 更改为 python-3.4.2

标签: python django heroku


【解决方案1】:

根据this heroku 确实支持python 3.4.3。您只需要使用适当的 pip 版本。所以 [pip3 install django-toolbelt] 而不是 [pip install django-toolbelt]

【讨论】:

  • 本地安装工具带的版本与服务器上运行的无关。
  • 我知道,但它奏效了。不知道为什么,也许有人会解释。不同版本的pip会不会产生不同的requirements.txt?
猜你喜欢
  • 2015-09-29
  • 2012-01-31
  • 1970-01-01
  • 2016-01-11
  • 2020-10-24
  • 2021-10-17
  • 2015-05-17
  • 2019-03-17
  • 1970-01-01
相关资源
最近更新 更多