django - create first view

Three Files needed 
     1) project folder's urls.py
     2) create and update music\urls.py
     3) update views.py in music folder
1)update website\urls.py
from django.conf.urls import include, url
from django.contrib import admin
from django.urls import path
urlpatterns = [
    url(r'^admin/', admin.site.urls),
      url(r'^music/',include('music.urls')),
]
2)create and update music\urls.py
from django.conf.urls import url
from . import  views

urlpatterns = [
    url(r'^$',views.index,name="index"),
]

3)updtae views.py in music folder
from django.http import HttpResponse

# Create your views here.
def index(reuest):
    return HttpResponse("

This is my music home page")

Reactions:

0 comments:

Post a Comment