URLS DJANGO

    0

    0

    oscar muñoz

    urlpatterns += path('articles/', views.articles, name='articles'),

    The above code declares two urlpatterns. The first one, path('', views.index, name='index'), will be called when no urlpattern is specified. The second one, path('articles/', views.articles, name='articles'), will be called when the articles urlpattern is encountered.

    urlpatterns = [

    path('', views.index, name='index'),

    ]

    urlpatterns += path('articles/', views.articles, name='articles'),

    In the above example, the path('articles/', views.articles, name='articles') will be called when a urlpattern is encountered that matches articles/ in the URL.

    Library: django

    Shortcut: urls

    Filename pattern: .py

    from django.urls import path
    
    from  import views
    
    urlpatterns = [
    
    
      path('', views.index, name='index'),
      
    
    ]
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.