Home > Software design >  Django Project - 'urlpatterns' = (syntax error - cannot assign to literal)....Please advis
Django Project - 'urlpatterns' = (syntax error - cannot assign to literal)....Please advis

Time:11-28

Django Project - 'urlpatterns' = (syntax error - cannot assign to literal)....Please advise?

CodePudding user response:

When you assign to a variable, you use an identifier, not a string literal, you thus construct the urlpatterns with:

# ↓↓↓↓↓↓↓↓↓ no string identifier
urlpatterns = [
    # …
]
  • Related