我的视图不起作用,这是我的urls.py,我不明白自己在做什么错。它只返回“找不到页面”

时间:2019-01-28 14:54:01

标签: python django django-urls

我的视图不起作用,这是我的urls.py,我不明白自己在做什么错。它只是返回“找不到页面”

from django.contrib import admin
from django.views.generic import TemplateView
from django.urls import path, include
from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required

from carts.views import cart_home, cart_update

from . import views

urlpatterns = [
    url(r'^cart/', include("carts.urls", namespace='cart')),
]   

views.py

from django.shortcuts import render, redirect
from billing.models import BillingProfile
from orders.models import Order
from products.models import Product
from .models import Cart
# Create your views here.


def cart_home(request):
    cart_obj, new_obj = Cart.objects.new_or_get(request)
    return render(request, 'carts/home.html', {"cart": cart_obj})

0 个答案:

没有答案