将我的django站点部署到heroku之后,除一页(查看页)并且其中显示服务器错误(500)之外,所有页面均正常运行。
设置中的代码
DEBUG = False
ALLOWED_HOSTS = ['.herokuapp.com', '127.0.0.1']
“查看”页面中的代码
@login_required(login_url='login')
@admin_only
def dashboard(request):
all_orders=Order.objects.all()
all_customers=customer.objects.all()
order_pending=Order.objects.filter(status='PENDING')
order_out = Order.objects.filter(status='OUT-FOR-DELIEVERY')
order_delievered = Order.objects.filter(status='DELIEVERED')
total_orders=all_orders.count()
total_orders_pending=order_pending.count()
total_orders_out=order_out.count()
total_orders_delievered=order_delievered.count()
context={'orders':all_orders, 'customers':all_customers, 'total_orders':total_orders,
'total_orders_pending':total_orders_pending, 'total_orders_out':total_orders_out,
'total_orders_delievered':total_orders_delievered}
return render(request, 'cms_app/Dashboard.html', context)
@login_required(login_url='login')
@allowed_user(allowed_roles=['admin'])
def product(request):
all_products=Product.objects.all()
context={'all_products':all_products}
return render(request, 'cms_app/Products.html',context)
@login_required(login_url='login')
@allowed_user(allowed_roles=['admin'])
def customer_data(request, id):
customers=customer.objects.get(id=id)
orders=customers.order_set.all()
all_orders=orders.count()
my_filters=OrderFilter(request.GET, queryset=orders)
orders=my_filters.qs
context={'customer_data':customers, 'all_orders':all_orders, 'orders':orders, 'my_filters':my_filters}
return render(request, 'cms_app/customer_Data.html',context)
如果有人知道此错误。请让我知道