首页视图和路由配置完善
views.py
def index(request):
if request.method == 'GET':
video_lists = Video_List.objects.all().order_by('video_list_order')
softs = Download.objects.all().order_by('down_time')[:3]
arts = Art.objects.all().order_by('art_time')[:10]
# 侧边栏
tags = Side.side_tags
new_arts = Side.side_new_arts
hot_arts = Side.side_hot_arts
context = {'video_lists': video_lists, 'softs': softs, 'arts': arts, 'tags': tags, 'new_arts': new_arts, 'hot_arts': hot_arts}
return render(request, 'index.html', context=context)
urls.py
from django.urls import re_path
from . import views
urlpatterns = [
re_path('^$', views.index),
]