在Django中使用whois



我正在尝试使用whois的外部库,但我正在获得错误[WinError 2] The system cannot find the file specified,我已将该包包含在我的设置文件中。下面是视图的代码:

class PreviousSearchView(View):
def post(self, request):
if request.method == 'POST':
searchdomain = request.POST['searchdomain']
domain = whois.query(searchdomain)           ##### Error on this line
date = datetime.datetime.now()
print(domain)
search = Search(
searchdomain = searchdomain,
date = date,
user = User.objects.get(id = request.user.id)
)
search.save()
return redirect('/')

whois包是linux的,如果你使用windows试试python-whois

最新更新