1.下载bootstrap源码,放在static目录中
https://v5.bootcss.com/docs/getting-started/download/
https://getbootstrap.net/docs/getting-started/introduction/
2.导入样式 js和css格式不同❗
3.找到setting.py修改STATIC_URL
STATIC_URL = '/static/'
STATICFILES_DIRS = ( os.path.join('static'), )
STATIC_ROOT = ''
4.setting.py修改TEMPLATES下的’DIRS’
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, "templates")],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
}服务器托管网,
},
]
5.找到应用下的view.py文件,修改如下:
#视图函数,返回index.html页面
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return render(request, 'index.html')
6.在跟路由urls.py文件修改如下:
from django.urls import path
from App import views
urlpatterns = [
# 首页
path('user/', views.index, name="index"),
]
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
git clone git://git.kernel.org/pub/scm/linux/git/stable/linux-stable.git cd linux-stable git checkout v5.4.50 git clone git://git.…