2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||||
""" | """ | ||||
from django.contrib import admin | from django.contrib import admin | ||||
from django.urls import path | |||||
from django.urls import include, path | |||||
urlpatterns = [ | urlpatterns = [ | ||||
path('posts/', include('posts.urls')), | |||||
path('admin/', admin.site.urls), | path('admin/', admin.site.urls), | ||||
] | ] |
from django.contrib import admin | |||||
# Register your models here. |
from django.apps import AppConfig | |||||
class PostsConfig(AppConfig): | |||||
name = 'posts' |
from django.db import models | |||||
# Create your models here. |
from django.test import TestCase | |||||
# Create your tests here. |
from django.urls import path | |||||
from . import views | |||||
urlpatterns = [ | |||||
path('', views.index, name='index'), | |||||
] |
from django.http import HttpResponse | |||||
# Create your views here. | |||||
def index(request): | |||||
return HttpResponse("Hello, world. You're at the posts index.") |