Participated in a project led by a big man ——IMUSTCTF,Oj After the project of system development, I learned a lot of development technology .
However, compared with the complete technology required for website development, there are many technologies that will not , So I explore the complete website development technology in my spare time .
There are records in the previous note file :
【Django frame 】 Learning and its 【 Database docking technology 】 Study && Development Notes 【 Introduction 】
Address :https://dev.mysql.com/downloads/mysql/
The latest is 8.0 edition , I chose the last latest one mysql-5.7.24-winx64.zip
zip The format is to decompress by yourself , After decompression, actually MySQL You can use it , But you need to configure environment variables zip The format is to decompress by yourself
My computer -> attribute -> senior -> environment variable
choice Path, Add after : Yours mysql bin Path to folder :
I am a win10 System , Be the same in essentials while differing in minor points , There was no screenshot , So steal other people's pictures
After configuring environment variables , stay F:\mysql\mysql-5.7.24-winx64\mysql-5.7.24-winx64 Add a new configuration file under the directory mysql.ini , At the same time bin Create a DATa Folder ( Used to store database data )
mysql.ini The contents of the document are as follows
[mysql]# Set up mysql Client default character set default-character-set=utf8 [mysqld]# Set up 3306 port port = 3306 # Set up mysql Installation directory basedir=F:\mysql\mysql-5.7.24-winx64\mysql-5.7.24-winx64# Set up mysql Database data storage directory datadir=F:\mysql\mysql-5.7.24-winx64\mysql-5.7.24-winx64\data# Maximum connections allowed max_connections=200# The character set used by the server defaults to 8 Bit coded latin1 Character set character-set-Server=utf8# The default storage engine that will be used when creating a new table default-storage-engine=INNODB
open cmd, You don't need to go to the installation directory (∵ Environment variables have been configured before ), Enter the following command , enter , No response
Enter the following command , enter , It will prompt that the installation is successful
mysqld install
Start the service , Enter the following command , enter , After successful startup, it is shown in the figure below
netstart mysql
After the service starts successfully , Enter the command when you need to log in ( No password for the first login , Press enter directly to pass )
mysql -uroot-p
Change Password ( Must be started first mysql), Execute the following command and enter ,enter password Come back , The password is usually set to root, Convenient memory
mysqladmin -u root -p password
installed mysql recommend :
Both software are particularly easy to use , Choose one .【 Baidu crack method 】
open Navicat Connect mysql This software is more convenient , Not too much configuration ,sqlyog Need configuration .【 The details are simple 】
There are notes in the previous article :
Click on :Django Connection method with database
File structure :
Set up :ALLOWED_HOSTS = ['*']
Facilitate our local access to .
Fill in “*” It can make all web sites accessible Django Project ,
When the project is tested , You can do that .
Join in “myapp” The path of :‘mylost’ by app File name
Next we need to talk to Django Describe the path of the template file , modify HelloWorld/settings.py, modify TEMPLATES Medium DIRS by [os.path.join(BASE_DIR, ‘templates’)], As shown below :
os.path.join(BASE_DIR,'TestModel/templates'),
Database connection configuration , It's mentioned above :
STATICFILES_DIRS tell django, First of all to STATICFILES_DIRS Look for static files inside , Then to each app Of static Look in the folder .
Join in :
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
introduce include
url First match django In the project url file , Then match the application app Medium url file . Step by step matching .
For example, in a project , Set to match null ' ' ——> Then it will match APP In application url.
You can copy the of the main route urls file , Change the value inside .
Front end path display
Load static file {% load static %}
Use reverse parsing technology to introduce css Corresponding documents
<!-- Introduction framework -->
<link rel="stylesheet" type="text/css" href="{% static 'css/font-awesome.4.6.0.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/snow.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
Introduce online jqurey, You can also put it locally
<script src="https://www.ym4j.com/jquery/jquery-1.8.2.min.js"></script>
establish templates Folder , Put in native login and registration html file .
establish static Folder , Deposit html Needed css,js And the referenced picture files .
The front end needs to be changed a lot , In order to apply , The details depend on the actual situation .
Temporarily write the login and registered user database , Not perfect yet .
cd To django Under the folder .
Generate migration file
python manage.py makemigrations
Perform the migration
python manage.py migrate
function
python manage.py runserver
Refer to previous articles :
Website Development Notes ——(django Introduction )
Database display :
python manage.py runserver
Because the main page doesn't write , First look at the login registration page ;
Successfully enabled
Gou huaisifangzhi , Where you can swim , Let's make progress together !
The first thought is state com
【Python】報:lxml.etree.XMLSyntax
Catalog Preface Scene one :