Monday, 25 February 2019

django 2

project1\urls.py

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('music/', include('music.urls')),
    path('watchman/', include('watchman.urls')),
]

-------------------------------------------

music\urls.py

from django.urls import path
from . import views

urlpatterns = [
    path('', views.index, name='index'),
]

-------------------------------------------

music\views.py

from django.shortcuts import render
from django.http import  HttpResponse

def index(request):
    return HttpResponse('<h1>music app homepage</h1>')

-----------------------------------------------

project1\settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'watchman',
]

No comments:

Post a Comment