当我在Django中安装djangorestframework-simplejwt 4.6.0
并尝试将其部署到Heroku
时,我得到以下错误:
remote: Downloading djangorestframework-3.12.2-py3-none-any.whl (957 kB)
remote: ERROR: Could not find a version that satisfies the requirement djangorestframework-simplejwt==4.6.0 (from -r /tmp/build_5927f5b0/requirements.txt (line 19)) (from versions: 1.0, 1.1, 1.2, 1.2.1, 1.3, 1.4, 1.5.1, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1, 3.0, 3.1, 3.2, 3.2.1, 3.2.2, 3.2.3, 3.3, 4.0.0, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.2.0, 4.3.0, 4.4.0)
remote: ERROR: No matching distribution found for djangorestframework-simplejwt==4.6.0 (from -r /tmp/build_5927f5b0/requirements.txt (line 19))
我试着安装和部署4.4.0,看看是否能找到4.6.0,我能够部署它,但当我尝试用python manage.py runserver
启动和访问它时,'str' object has no attribute 'decode'
。
为什么会发生这种情况?如果你能告诉我如何喂养它们,我将不胜感激。
将您在heroku中的python运行时更改为3.7或更高版本。我也遇到了类似的问题,所以在django项目的根文件夹中创建一个runtime.txt文件,并指定您想要的python版本,例如python-3.8.11。