def add_venue(request):
submitted = ('submitted' in request.GET)
if request.method == 'POST':
form = VenueForm(request.POST)
if form.is_valid():
word = form.cleaned_data['word']
if not Newword.objects.filter(word=word).exists():
explanation = get_word(word)
# (do something with `explanation` probably?)
form.save()
return HttpResponseRedirect('/list/')
else:
form = VenueForm()
return render(request, 'form.html', {'form': form, 'submitted': submitted})
1条答案
按热度按时间u1ehiz5o1#
启动整个TwistedReact器、线程池以及请求中包含的CrawlerProcess的所有内容并不是一个好主意。
您根本不需要Scrapy来解析单个页面;请改用
requests
和bs4
(美丽的汤)。打印出
因此将其插入到您的视图中(并将其简化一点):