0
간단한 스크립트를 작성했지만 스크립트에 루프가 있으면 products
및 allbrands
변수가 루프를 제거 할 때를 제외하고는 변수가됩니다. 여기는 스크립트의 일부입니다.Python Django for 루프가 제대로 작동하지 않습니다.
products = amazon.search(Brand="Microsoft", SearchIndex="Software", ResponseGroup="Images,ItemAttributes,Accessories,Reviews,VariationSummary,Variations")
allbrands = Brand.objects.all();
for i, product in enumerate(products):
print ("Product");
context = {
'products': products,
'allbrands': allbrands
}
return render(request, 'storefront/index.html', context)
감사합니다. 그게 효과가있어. – user3072613