程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

⒂ Django creates the home page view of the blog

編輯:Python

This chapter is accompanied by video tutorials :

  • Python-Django Develop personal blog from scratch _ Bili, Bili _bilibili
  • Python-Django Develop personal blog from scratch _ Bili, Bili _bilibili

One at a time APP The creation logic of the back view is basically the following three steps , In the later stage of development, all of them focus on these four steps !

1、 stay blog Create a templates Folder , Create a folder with the same name as the blog in this folder blog Template file for storing blog .

  • Path is :blog/templates/blog/index.html

2、 stay views.py Create blog home page view in index

def index(request):
return render(request, 'blog/index.html')

3、 stay blog Next create a urls.py file , Blog routes are mainly placed here

  • Path is :blog/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name&

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved