djangoの新機能です.Visual.pyファイルに無効な構文エラーが発生しています。私はdjangoで構文エラーをデバッグする方法はありますか?私は以下のエラー無効な構文(views.py、34行目)
を取得していたrunserverのpython manage.pyと開発サーバを実行している場合===============
SyntaxError at/
invalid syntax (views.py, line 34)
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.8.5
Exception Type: SyntaxError
Exception Value:
invalid syntax (views.py, line 34)
Exception Location: /home/arajguru/training/mycode/myshop/orders/urls.py in <module>, line 2
Python Executable: /home/arajguru/training/mycode/env/myshop/bin/python
....... ===============
Below is my views.py file:
from django.shortcuts import render
from .models import OrderItem
from .forms import OrderCreateForm
from cart.cart import Cart
#from .tasks import order_created
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
def order_create(request):
cart = Cart(request)
if request.method == 'POST':
form = OrderCreateForm(request.POST)
if form.is_valid():
order = form.save()
for item in cart:
OrderItem.objects.create(order=order,
product=item['product'],
price=item['price'],
quantity=item['quantity'])
# clear the cart
cart.clear()
# launch asynchronous task
# order_created.delay(order.id)
# set the order in the session
request.session['order_id'] = order.id
# redirect to the payment
return redirect(reverse('payment:process'))
else:
form = OrderCreateForm()
return render(request,`enter code here`
'orders/order/create.html',
{'cart': cart, 'form': form}
34行目は、自分以外の人にはあまり意味がありません。質問するときは[mcve]を作成してください。 – Sayse