我正在将Django 1.11升级到Django 2.2。我做了所有必须做的事情。一个小问题。它说urls.py中存在语法错误,这是urls.py文件:
urlpatterns = [
path('', home_page, name='home'),
path('about/', about_page, name='about'),
path('accounts/login/', RedirectView.as_view(url='/login')),
path('accounts/', RedirectView.as_view(url='/account')),
path('account/', include("accounts.urls"), # , namespace='account')
path('accounts/', include("accounts.passwords.urls")),
path('address/', RedirectView.as_view(url='/addresses')),
path('addresses/', AddressListView.as_view(), name='addresses'),
path('addresses/create/', AddressCreateView.as_view(), name='address-create'),
path('addresses/(?P<pk>\d+)/',
AddressUpdateView.as_view(), name='address-update'),
path('analytics/sales/', SalesView.as_view(), name='sales-analytics'),
path('analytics/sales/data/', SalesAjaxView.as_view(),
name='sales-analytics-data'),
path('contact/', contact_page, name='contact'),
path('login/', LoginView.as_view(), name='login'),
path('checkout/address/create/', checkout_address_create_view,
name='checkout_address_create'),
path('checkout/address/reuse/', checkout_address_reuse_view,
name='checkout_address_reuse'),
path('register/guest/', GuestRegisterView.as_view(), name='guest_register'),
path('logout/', LogoutView.as_view(), name='logout'),
path('api/cart/', cart_detail_api_view, name='api-cart'),
path('cart/', include("carts.urls"),
path('billing/payment-method/', payment_method_view,
name='billing-payment-method'),
path(r'billing/payment-method/create/', payment_method_createview,
name='billing-payment-method-endpoint'),
path('register/', RegisterView.as_view(), name='register'),
path('bootstrap/', TemplateView.as_view(template_name='bootstrap/example.html')),
path('library/', LibraryView.as_view(), name='library'),
path('orders/', include("orders.urls"), # , namespace='orders')
path('products/', include("products.urls"), # , namespace='products')
path('search/', include("search.urls"), # , namespace='search')
path('settings/', RedirectView.as_view(url='/account')),
path('settings/email/', MarketingPreferenceUpdateView.as_view(),
name='marketing-pref'),
path('webhooks/mailchimp/', MailchimpWebhookView.as_view(),
name='webhooks-mailchimp'),
path('admin/', admin.site.urls)
]
这是在此处引发的snytax错误。我想我做对了所有事情,但我仍然不知道这里出了什么问题。
> File
> "c:\Users\Administrator\Desktop\eCommerce-master\src\ecommerce\urls.py",
> line 82
> ]
> ^ SyntaxError: invalid syntax
请帮助我预先感谢您的帮助
答案 0 :(得分:4)
path('orders/', include("orders.urls"), # , namespace='orders')
path('products/', include("products.urls"), # , namespace='products')
path('search/', include("search.urls"), # , namespace='search')
这些缺少一些寄生物