[英]Django application error when deploying to heroku
I want to deploy my Python / Django application on Heroku but I'm caught up with this weird error.我想在 Heroku 上部署我的 Python/Django 应用程序,但我遇到了这个奇怪的错误。 One of the errors I couldn't fix was
我无法修复的错误之一是
wrapt==1.12.1) is not available for this stack (heroku-18)
I have searched everywhere on the internet and pip
installing wrapt==1.12.1
but still, I kept getting the same error.我已经在互联网上到处搜索并
pip
安装wrapt==1.12.1
但仍然出现相同的错误。 What is the problem, and how can I fix it?有什么问题,我该如何解决?
The full error message is below.完整的错误消息如下。
You are only quoting part of the error message.您只是引用了错误消息的一部分。 Here's a more complete quote:
这是一个更完整的报价:
Requested runtime (appdirs==1.4.4
asgiref==3.2.7
...
wrapt==1.12.1) is not available for this stack (heroku-18
This indicates a problem with your runtime.txt
file .这表明您的
runtime.txt
文件存在问题。 That file isn't for defining your dependencies;该文件不是用于定义您的依赖项; it's for telling Heroku what version of Python you want to use.
它用于告诉 Heroku 您想使用哪个版本的 Python。 It should only contain something like
它应该只包含类似
python-3.8.5
Dependencies go into a file called requirements.txt
(or, if you're using Pipenv, Pipfile
and Pipfile.lock
, but that doesn't seem to apply here).依赖项进入一个名为
requirements.txt
的文件(或者,如果您使用 Pipenv、 Pipfile
和Pipfile.lock
,但这似乎不适用于此处)。
I suspect simply renaming your runtime.txt
to requirements.txt
, committing the change, and redeploying will work.我怀疑只需将您的
runtime.txt
重命名为requirements.txt
,提交更改并重新部署即可。 If you want to specify a particular Python version, you should also create a new runtime.txt
in the correct format.如果要指定特定的 Python 版本,还应该以正确的格式创建新的
runtime.txt
。
After installing wrapt==1.12.1 follow this steps:安装wrapt==1.12.1 后,请按照以下步骤操作:
Write below command in your reminal:在你的记忆中写下以下命令:
pip freeze > requirements.txt
git add .
git commit -m "edit"
git push heroku master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.