Mir Stephen
Mir Stephen

Reputation: 1927

How do I spot syntax error in urls.py file in Django?

I am upgrading Django 1.11 to Django 2.2. I did all what have to be done. One tiny problem. It says there is a syntax error in urls.py this is urls.py file here:

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)
]

This is the snytax error thrown here. I think I did everything right, still I don't have any clue what is going on wrong here.

>   File
> "c:\Users\Administrator\Desktop\eCommerce-master\src\ecommerce\urls.py",
> line 82
>     ]
>     ^ SyntaxError: invalid syntax

Please kindly help me thank you in advancefor your help

Upvotes: 0

Views: 58

Answers (1)

andreihondrari
andreihondrari

Reputation: 5833

path('orders/', include("orders.urls"),  # , namespace='orders')
path('products/', include("products.urls"),  # , namespace='products')
path('search/', include("search.urls"),  # , namespace='search')

These are missing some parantheses

Upvotes: 4

Related Questions