搭建自己的博客(六):添加首页,使用css对界面做美化
之前优化了一些代码,但是之前进入首页直接进入了博客列表,今天添加了首页,以区分和博客的区别,并且使用css代码美化了之前的一些东西。
1、变化的部分,先上图:(蓝色表示修改,红色表示新增)
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAK8CAYAAAAeW1FGAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AACAASURBVHic7d17cBXXnSfwb0uAZfEQYAkiyYiHMRDzMI/Y4Im9NjOpncnYnp1kPDM4dsVTs3lUkp2ZmknVVopiinjH8f6zydbOlmey60rV2JXEzox3nQcY2NjY2A424GAsMOYlhCSQQEjiIYRAQvfuH5cWTasf55w+3X369vdTRXFvP8+90vnpnNPdv2Pd/+DaIkJs3LAeAPD0M88KLQ87jpvfcWWOnZS62lqcOXMa10YKmDBhgu92Dz/2uOfywx8349gnH8dVvDFEfkayP8cosvb96ZDk9xuV6M/H+q//83+PCRybX3nppvdeFVm1cru/RF1BKSm33HILJk+aiOPHWzFlyhTAsjy38/vFD+P+7nXYuGF96Pcoso0OaX1/SX0+P1HPb9rPp0L2wBs3rPdtOajwCkQmu3r1KgqFIqZOnYqrQ1fTLk7m8Pszm+jPRzpwENB/6RJqa2/D0NUhFIuhPT0URgroaG1BR2sLCiOFBEpoNn5/ZhP5+YzTdbKwFoNfMytKl8R9Tq9jBJUrqLUTVJ7h4WEMDQ/jttum48LFftx6662B5dy3eye6TnUAALpPd2LVfQ8Ebu9kN1Gd//uV3bne/RmijhuF7e9XDq9tk/7+RD5D0Pcm+v37HVu2nH7HVyl/2PG9iPx8pAKH+4sL+2UJ+uXR9YvsPJe7HyhSHr9lYX3KgYHLqJkyBT09vaG/+Ge7u0Zf93SfDv9wLu5fXucy93L3e5tXZZA9v+p7L0l9f+7vy4vo5xH5/sPOJXJ+9/F1lT/snE5hPx8tXRWRKOwV8VTHN7wqu86xEmfZ/FTfeisuXbq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mAz1iqdXCKolIJQraJkol9KrE7paBLK+WRZTjUTZxXhUA7S3HYN37RVj18z3Xr17Yh+/86SE0t9Zg408WSx07aqUK2z+si5BkpWZrIy84rwoAYGDgIqza228suNQLDPYDAMYND2Dtsm4AwB31l6SO61eRRCuzyP5hlVV3RY6jFUPZlevAYVkVKBZGAACFY3vwg5XfQ3VV6X1N9TBuGV8AAFwbid6ji6MF4tficI+9OLf3G2MJO2eSQYrMl+vAMXHSFFzs7YDVsAjoPII5n/ceIN53fKrUcb3+EtvLvFoN9jL7vcj+QUEhqAyyn4PIS66vqpzr6Ubz3j0ojJRaGa9u2IkigIPtUwAAhzomo6OnGh8cnYaBK+bE2KCujK7KLnIsjm2UJ5FkxbkOHABw5fJltB0/is6ONry6YScAYPiahV/sakRXXxW2fzQjjWKGCrvXQtexg8ZaGDTKEwOHpG9/4QgWz74AANh9eDpe3D4Hl68Gf4FE5UYkcJjT/jbA919dkHYRiDIh1zeAEZEaBg4iksauChEJ47wqRCSJ86oQkbQymFdlwV1LceTgfjz82ONj1m1+5aUUSkRU/ux5Vf4/RGQs33+QJHoAAAAASUVORK5CYII=" alt="" />
2、上代码:
# -*- coding: utf-8 -*-
# @Time : 18-11-4 下午5:22
# @Author : Felix Wang from django.urls import path
from . import views urlpatterns = [
path('', views.blog_list, name='blog_list'),
# name 表示别名
path('<int:blog_pk>', views.blog_detail, name='blog_detail'),
# 链接非常容易混掉,所以要区分,在链接前面添加type
path('type/<int:blog_type_pk>', views.blogs_with_type, name='blogs_with_type'),
]
blog下的urls
"""
Django settings for myblog project. Generated by 'django-admin startproject' using Django 2.1.3. For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
""" import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'ea+kzo_5k^6r7micfg@lar1(rfdc08@b4*+w5d11=0mp1p5ngr' # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog.apps.BlogConfig', # 将自己创建的app添加到设置中
] MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
] ROOT_URLCONF = 'myblog.urls' 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',
],
},
},
] WSGI_APPLICATION = 'myblog.wsgi.application' # Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'myblogs', # 要连接的数据库,连接前需要创建好
'USER': 'root', # 连接数据库的用户名
'PASSWORD': 'felixwang', # 连接数据库的密码
'HOST': '127.0.0.1', # 连接主机,默认本级
'PORT': 3306 # 端口 默认3306
}
} # Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
] # Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/ # LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'zh-hans' # TIME_ZONE = 'UTC'
TIME_ZONE = 'Asia/Shanghai' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/ STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static")
]
settings
"""myblog URL Configuration The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from . import views urlpatterns = [
path('', views.home, name='home'), # 主页路径
path('admin/', admin.site.urls),
path('blog/', include('blog.urls')), # 博客app路径
]
myblog下的urls
# -*- coding: utf-8 -*-
# @Time : 18-11-7 下午4:12
# @Author : Felix Wang from django.shortcuts import render_to_response def home(requests):
return render_to_response('home.html', {})
myblog下的views
body, * {
margin: 0;
padding: 0;
} div.nav {
background-color: #eeeeee;
border-bottom: 1px solid black;
padding: 10px 5px;
} div.nav a.logo {
display: inline-block;
font-size: 120%;
} div.nav a {
text-decoration: none;
color: black;
padding: 5px 10px;
}
base.css
.home-content {
font-size: 222%;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
home.css
{% load staticfiles %} <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>
{# 用来放标题 #}
{% block title %} {% endblock %}
</title>
<link rel="stylesheet" href="{% static '/css/base.css' %}">
{#下面这种和上面这种效果一模一样,但是推荐使用上面这种#}
{# <link rel="stylesheet" href="/static/css/base.css">#} {% block header_extends %}
{% endblock %}
</head>
<body>
<div class="nav">
<a class="logo" href="{% url 'home' %}">
<h3>felix Blog</h3>
</a>
<a href="{% url 'home' %}">首页</a>
<a href="{% url 'blog_list' %}">博客</a>
</div>
{# 用来放内容 #}
{% block content %} {% endblock %} </body>
</html>
base.html
{% extends 'base.html' %}
{% load staticfiles %} {% block header_extends %}
<link rel="stylesheet" href="{% static 'css/home.css' %}">
{% endblock %} {% block title %}
我的网站|首页
{% endblock %} {% block content %}
<h1 class="home-content">欢迎访问我的博客</h1>
{% endblock %}
home.html
3、知识点梳理
(1)、静态文件
首先在项目目录下新建一个static文件夹用来存放诸如css,js,img等静态文件。
新建之后如何让django找到这个静态目录呢?这时我们需要在django的settings文件中指定静态目录地址:
如下
# 在settings中添加静态文件路径
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static")
]
(2)、使用静态文件
静态文件的使用方式有两种。
a、通过访问路径的方式添加
如添加css文件:
# 这种方式通过访问路径的形式加载使用静态文件
<link rel="stylesheet" href="/static/css/base.css">
b、通过模板语言的方式添加
# 加载静态文件放在html文件开头
{% load staticfiles %} # 非常推荐使用这种方式加载静态文件
<link rel="stylesheet" href="{% static '/css/base.css' %}">
搭建自己的博客(六):添加首页,使用css对界面做美化的更多相关文章
- github+hexo搭建自己的博客网站(六)进阶配置(搜索引擎收录,优化你的url)
详细的可以查看hexo博客的演示:https://saucxs.github.io/ 绑定了域名: http://www.chengxinsong.cn hexo+github博客网站源码(可以clo ...
- 第1章 Express MongoDB 搭建多人博客
学习环境 Node.js : 0.10.22 + Express : 3.4.4 + MongoDB : 2.4.8 + 快速开始 安装 Express express 是 Node.js 上最流行的 ...
- 如何搭建一个独立博客——简明Github Pages与Hexo教程
摘要:这是一篇很详尽的独立博客搭建教程,里面介绍了域名注册.DNS设置.github和Hexo设置等过程,这是我写得最长的一篇教程.我想将我搭建独立博客的过程在一篇文章中尽可能详细地写出来,希望能给后 ...
- github+hexo搭建自己的博客网站(七)注意事项(避免read.me,CNAME文件的覆盖,手动改github page的域名)
详细的可以查看hexo博客的演示:https://saucxs.github.io/ 绑定域名可以查看:http://www.chengxinsong.cn 可以查看在github上生成的静态文件(如 ...
- 如何搭建github+hexo博客-转
1.前言 其实早在这之前我就一直想过写博客,但由于种种原因一直没有去学习这方面的知识,最近半个月(从开始动手到搭建好)一直陆陆续续的在着手这方面的工作.从开始到搭建完成的过程中遇到了很多困难,因为在这 ...
- VuePress从零开始搭建自己的博客
VuePress是什么? VuePress是以Vue驱动的静态网站生成器,是一个由Vue.Vue Router和webpack驱动的单页应用.在VuePress中,你可以使用Markdown编写文档, ...
- 利用Github免费搭建个人主页(个人博客)
之前闲着, 利用Github搭了个免费的个人主页. 涉及: Github注册 Github搭建博客 域名选购 绑定域名 更多 一 Github注册 在地址栏输入地址:http://github.co ...
- Hexo + Github Pages搭建的个人博客
这个不算是新手的搭建流程,如果你恰巧看见这篇文章,希望你已经安装好node.git等软件,因为第一步的环境搭建准备并没有详写,默认都会了.希望能解决你的问题. 步骤: 一. 搭建环境准备 二.安装he ...
- 基于ECS搭建云上博客
场景介绍 本文为您介绍如何基于ECS搭建云上博客. 背景知识 本场景主要涉及以下云产品和服务: 云服务器ECS 云服务器(Elastic Compute Service,简称ECS)是阿里云提供的性能 ...
随机推荐
- oracle sqlplus命令
show和set命令是两条用于维护SQL*Plus系统变量的命令 SQL> show all --查看所有68个系统变量值 SQL> show user --显示当前连接用户 SQL> ...
- PAT-1111 Online Map (30分) 最短路+dfs
明天就要考PAT,为了应付期末已经好久没有刷题了啊啊啊啊,今天开了一道最短路,状态不是很好 1.没有读清题目要求,或者说没有读完题目,明天一定要注意 2.vis初始化的时候从1初始化到n,应该从0开始 ...
- puppet工作原理及部署redis主从篇
一.简介 1.国际惯例什么是puppet puppet是一种Linux.Unix.windows平台的集中配置管理系统,使用自有的puppet描述语言,可管理配置文件.用户.cron任务.软件包.系统 ...
- .NET Standards
.net的创始者们在一开始的时候,就意识到了他们的编程技术可以用在不通的操作系统和不同类型的cpu上.他们改进了20世纪90年代编程语言实现技术.最主要的一条是,不同的编程语言对应统一个运行时,及CL ...
- Go 操作 Mysql(一)
关于 Go 的标准库 database/sql 和 sqlx database/sql 是 Go 操作数据库的标准库之一,它提供了一系列接口方法,用于访问数据库(mysql,sqllite,oralc ...
- shim和polyfill 区别解释
polyfill 是 shim 的一种.shim 是将不同 api 封装成一种,比如 jQuery 的 $.ajax 封装了 XMLHttpRequest 和 IE 用 ActiveXObject 方 ...
- 关于文本设置overflow:hidden后引起的垂直对齐问题
目前有这样的需求,一行标题中,前面为图标,后面是文字,文字要实现一行省略的效果 首先把文字设为:display: inline-block; 然后设置省略: overflow: hidden; wor ...
- RZ70注册SLD
本文的将S4 abap系统向PO JAVA系统中注册. S4 QASERPAP01 NR=60 ASCS=61 PO QASPISAP01 NR=60 SCS=61 http://qaspisap01 ...
- 记一次SQL PLUS 不能登录的异常处理
记一次SQL PLUS 不能登录的异常处理 现象 通过远程PLSQL Developer 访问数据发现卡死没响应. 通过Sqlplus 访问数据同样hang死在登录界面,且不能通过Ctrl+C取消 [ ...
- Django中使用JWT
JWT """ 1.组成: header.payload.signature 头.载荷.签名 2.距离: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1 ...