大佬教程收集整理的这篇文章主要介绍了ModuleNotFoundError: 没有名为“spotipy”的模块,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在本地运行应用程序时,我能够得到结果。
但是在 Heroku 上部署时,我收到以下错误:ModuleNotFoundError: No module named 'spotipy'
settings.py:
INSTALLED_APPS = [
"django.contrib.admin","django.contrib.auth","django.contrib.ContentTypes","django.contrib.sessions","django.contrib.messages","django.contrib.staticfiles","hello","corsheaders","spotipy",//added it over here
]
requirements.txt:
django
gunicorn
django-heroku
requests
spotipy
vIEws.py:
from django.shortcuts import render
from django.http import httpResponse
from .models import Greeting
import requests
import Json
from django.http.response import JsonResponse
import spotipy
from spotipy.oauth2 import SpotifyClIEntCredentials
# Create your vIEws here.
def index(request):
uri = 'random artist'
spotify = spotipy.Spotify(clIEnt_credentials_manager=SpotifyClIEntCredentials(clIEnt_ID='confIDential',clIEnt_secret = 'confIDential'))
artist = spotify.show(uri,market = "IN")
return JsonResponse(artist)
def db(request):
greeting = Greeting()
greeting.save()
greetings = Greeting.objects.all()
return render(request,"db.HTML",{"greetings": greetings})
过程文件:
web: gunicorn gettingstarted.wsgi
我是前端开发的新手,请帮忙
尝试在requirements.txt中定义版本
spotipy==2.17.1
以上是大佬教程为你收集整理的ModuleNotFoundError: 没有名为“spotipy”的模块全部内容,希望文章能够帮你解决ModuleNotFoundError: 没有名为“spotipy”的模块所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。