1. Prospect Summary
1.1, Background Introduction
-
This article is a comprehensive summary of my graduation project, involving programming codes of some important sections.
-
It is a web-based face recognition project, and I hope that students who have related needs can benefit from it.
-
Because I only learned the python language roughly in my sophomore year, and I missed the autumn recruits to prepare for the spring recruits, I completed it within one month starting in May.
-
Frameworks, etc. are all learned from scratch, most of the content is repeated, and the code is extremely unsuccinct. Please correct me if I find any mistakes.
-
Baidu network disk link: https://pan.baidu.com/s/161t1U0rAY7axadZmTRV_bQ Extraction code: mbzk
1.2, Knowledge Reserve
-
HTML:https://blog.csdn.net/weixin_44264744/article/details/104129183
-
CSS Basics: https://blog.csdn.net/weixin_44264744/article/details/104132573
-
JavaScript:https://blog.csdn.net/weixin_44264744/article/details/104174133
-
Python language: https://blog.csdn.net/weixin_44264744/article/details/105339873
-
Django official website: https://docs.djangoproject.com/en/3.0/intro/tutorial02/
-
BootStrap官网:https://www.bootcss.com/
-
HighCharts official website: https://www.highcharts.com.cn/docs/start-helloworld
1.3, reference website overview:
-
Liu Jiang Blog: https://www.liujiangblog.com/course/django/138D
-
Article pagination: https://www.cnblogs.com/donghaiming/p/11007505.html
-
Form writing: https://www.cnblogs.com/tyler-bog/p/11040914.html
-
Boxuegu Project: https://xuexi.boxuegu.com/video.html?courseId=1150
-
Multi-list rendering: https://blog.csdn.net/qq_41448891/article/details/90318298
-
Django Zero Foundation: https://www.bilibili.com/video/BV1Wt411K7QH?from=search&seid=13601957935054218903
-
Login and register the detailed version: https://www.cnblogs.com/robindong/p/9610057.html
1.4, platform required
-
OS: Windows 64 bit
-
Third-party libraries: OpenCV, numpy, os, urlib, io, time, dlib, etc.
-
Development language: Python
-
Database: sqlLite3
-
Editor: Pycharm
-
Package management tool: Anaconda
Second, the main page effect display
2.1, registration page
2.2, Email Verification Page
2.3, landing page
2.4, logout page
2.5, the main page
2.6, the teacher publishes the course
2.7, the teacher's curriculum
2.8, course sign-in release
2.9, the teacher checks the attendance status
2.10, Students choose courses
2.11, Student Course Selection List
2.12, Student attendance
2.13, Student attendance check-in
2.14, face value measurement:
2.15, video tutorial learning:
Third, use the configuration
3.1, installation and configuration tutorial
-
Pycharm needs to reinstall some third-party libraries every time a new project is created.
-
Pycharm import anaconda environment PyCharm+Anaconda environment configuration
-
The download addresses for most libraries look in the Python installation directory
3.2, package installation
-
Note: The installation of packages pays attention to the version compatibility between each other, and the code writing is sometimes different for different versions.
-
Method 1: In Anaconda Prompt: pip install library name -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com image acceleration
-
Method 2: Download the .whl file, cd to the corresponding directory through the command line, and install the download address of most libraries through pip
-
Method 3: Anaconda Navigator installation: Click the green circle, select the second line on the left, environment, root, not installed, search for the corresponding package name, and install
-
Notice:
-
When installing packages, pay attention to the version compatibility between each other, and the code writing is sometimes different for different versions.
-
urllib and urllib2 are merged in versions after Python3, the installation should be: pip install urllib3
-
It is best to specify 14/pip install tensorflow==1.15 to install tensorflow in Python3.7 version
-
The Dlib version corresponding to Python3.7 needs to be 3.7, and most of the online versions are 3.6. The link is as follows
-
The haarcascades file corresponding to face detection Opencv
-
3.3, common command line operations
-
Switch to E drive: E:
-
Toggle previous: cd ..
-
Switch to the specified path: cd pathname
-
pip operation version update: python -m pip install --upgrade pip
-
Force installation of the corresponding library: pip install --ignore-installed <library name>
-
Check python version: python -V
-
View the packages installed by anaconde: conda list
3.4, create a Django project
-
Method 1: Create from the command line
-
pip install django==1.8.2 //Download the corresponding package
-
Go to the corresponding directory, cmd, press Enter to open the command line (OR use **administrator to switch** to the appropriate directory)
-
django-admin startproject project name //Create a project, **cd project name**, go to the corresponding project
-
python manage.py startapp app // Create app, if pycharm needs venv\Scripts\activate
-
python manage.py runserver//start the project
-
-
Method 2: Create a project through Pycharm
-
Open Pycharm, click file, select new project, click Django, Location is the created project location
-
Click File, click Settings, select Project interpreter, and the corresponding installed packages are displayed on the right:
-
3.5, environment configuration
For details, please see: https://blog.csdn.net/weixin_44264744/article/details/105339873 Fifth, the framework of Django
Resource directory:
app project:
Setting configuration:
......
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions', #自带的session缓存模式
'django.contrib.messages',
'django.contrib.staticfiles',
'face', #添加app名字
]
......
DATABASES = { #数据库配置 sqlite3
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
......
DATABASES={
'default': {
'ENGINE': 'django.db.backends.mysql', #数据库类型
'NAME':'ttsx', #名字
'HOST':'localhost', # 地址
'PORT':'3306', #端口
'USER':'xxxxx', #账号
'PASSWORD':'xxxx', #密码
}} #model.py 开头添加from future import unicode_literals,mysql连接需要安装Pillow
......
LANGUAGE_CODE = 'zh-hans' #改换成中国时区
TIME_ZONE = 'Asia/Shanghai'
......
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static') #无论目录是APP/根或是其它 方便查找static
]
url.py configuration:
from django.contrib import admin
from django.urls import path, include
from face import views #从对应app内导入函数
urlpatterns = [
path('admin/', admin.site.urls),
path('register',views.Register),
]
100 beautiful landing registration pages