Answers for "django home url"

1

django link home page

---urls.py:---
from django.conf.urls.defaults import *

urlpatterns = patterns('myproject.views',
    url(r'^$', 'index', name='index'), #name is important
)

---Templates:---
<a href="{% url 'index' %}">
Posted by: Guest on March-30-2021

Python Answers by Framework

Browse Popular Code Answers by Language