Qita Continued
$ python manage.py startapp picblog
INSTALED_APPS =[
'picblog.apps.PicblogConfig',
]
Create a template folder in picblog and create a new folder called picblog in it. Write html here.
Create base.html and home.html in the created template / picblog folder.
Write the characters you want to represent in home.html
hello world
from django.views.generic import TemplateView
class Home(TemplateView):
template_name='picblog/home.html'
Open config urls.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('',include('picblog.urls')),
path('admin/', admin.site.urls),
]
Create urls.py in picblog app
Home is the class name written in views.py
from django.urls import path
from . import views
app_name='picblog'
urlpatterns=[
path('',views.Home.as_view(),name='home'),
]
$python manage.py runserver
OK if hello world appears on the updated web page
Recommended Posts