Deploy library management system library management system project deployment project

 

Deploy library management system project

 

 

Deployment Readiness

Deploy project management books you will use the following software

  • nginx
  • uWSGI
  • CentOS7
  • Library management deployment project file
  • virtualenv
  • supervisor

WSGI, uWSGI

python web server development using the WSGI protocol (Web Server Gateway Interface)

python web project will generate a default wsgi.py file to determine a good application module.

Production environment using uWSGI, writing implements WSGI all interfaces, C language, very efficient web server.

uWSGI is a full-featured HTTP server to achieve the WSGI protocol, uwsgi agreement, http agreement. It is to do is to be converted to HTTP protocol language supported network protocols. For example, the HTTP protocol is converted into WSGI protocol, so Python can be used directly.

Nginx

Nginx is to use its reverse proxy feature, the project will be deployed server line by Django + uWSGI + Nginx.

CentOS

1. packaged CRM project folder, file compression

2. xftp, scp, lrzsz such as uploading files to the server Centos

Linux Tips

1. xshell or iTerm software, multi-terminal operation of your linxu, so to uwsgi, nginx, project code debugging time, avoid switching back and forth directory, provide efficiency.

Note 2. Modify the linux software configuration file must restart the service to take effect.

Virtualenv

Build a clean, isolated python interpreter environment, to prevent the problem software dependency, conflict, recommended.

Supervisor

Supervisor (http://supervisord.org/) is developed with a client Python / server services, is a process management tool under Linux / Unix systems, Windows systems are not supported. It can easily monitor, start, stop, restart one or more processes. Supervisor with process management, when a process is killed unexpectedly, supervisort to monitor the process of death, it will automatically pull up again, it is convenient to do the process of automatic recovery functions, eliminating the need to write shell scripts to control.

 

Begin deployment

1, familiar with linux operating

linux basic operation command omitted .....

 

2, python3 interpreter installed

Reference blog: https://www.cnblogs.com/tiger666/articles/10312522.html

 

3, virtualenvwrapper configuration tools, virtual solve environmental problems

# Confirm ~ / .bashrc virtualenvwrapper arranged inside the profile 
WORKON_HOME = ~ / Envs that
VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
VIRTUALENVWRAPPER_PYTHON=/opt/python36/bin/python3
source /opt/python36/bin/virtualenvwrapper.sh

# Create and activate a virtual environment for library management system project 
mkvirtualenv book_manage_env

 

4, installation configuration MariaDB database, and create database data, migrate data import library management system

(1) install and start MariaDB database

In CentOS7, MariaDB is mysql database, just a different package name

# Use yum to download and install MariaDB 
yum install MariaDB MariaDB-Client-Server - the y-

# Start mariadb server 
systemctl start mysql

(2) connected and authorized root users to remotely access

# Use the client to link mysql server 
mysql-uroot-- the p-landing mariadb on linux

# Note 1, linux database, you need to set up a remote link to the root user privileges, password is qishi3q 
Grant All privileges ON * * to root @. ' % ' IDENTIFIED by ' qishi3q ' ;
 # authorize all rights, in all the libraries, All tables for the root user on all hosts, set permissions password is qishi3q 
# refresh authorization form 
flush privileges;

Note 2, linux firewall and selinux to be closed, otherwise windows to linux link port 3306 may be denied

Data (3) import library management project

 

In the data server linux, mysql, import library management system

# Export 1.mysql data, and import 
this command in linux / knock windows in
mysqldump -u root -p --all-databases >  book_manage.dump  

# 2. Upload the data files to the database linux

# 3. mysql Linux are introduced, the data file (in the dump file to specify the database: use szday58) 
mysql the root -p -u </ opt / book_manage.dump
 # or entered into the database in mysql, use the command: 
Source / opt / book_manage.dump

 

5, into the virtual environment and run the project

The test uses linux python interpreter to run the project to switch to the project running (Note To solve the problem interpreter module to the normal operation of the project)

# Use 127.0.0.1 not, can only access this machine, to get everyone to access, you must use 0.0.0.0 
python3 manage.py the runserver 0.0.0.0:8000

Then you can access through IP plus port, if this is my IP cloud server IP, then we went to the interview, you can take this project to show the interviewer on the computer, there is a good format to force ah ~

 

Eggs : There is now a problem, we can access the project through 10.0.0.7:8000, but the public Internet website is not so, ah , such as Luffy Xuecheng, is accessed through the domain name, we can resolve the way out of the fly Xuecheng the server IP, can also be accessed through the address, but no increase port on the rear, because the default port 80 is used

Although we can directly port to 80 no problem, then the question arises: 

1 django run the web interface by default, it wsgiref stand-alone module, the performance will be relatively low, you need to how to solve?

uwsgi + django + nginx

2 We want to rerun a project to provide services, how to do it? Only a 80-port server, how to solve

nginx + uwsgi + django + supervisor

 

 


- to complete the installation of nginx configuration to learn how to configure nginx.conf

- complete uWSGI commands to learn, use uWSGI start knight projects to support multi-process

- complete nginx static file handling library management project

- final results

visit 80 ports nginx, you can find library management page, and ensure the normal static files page

 

 

Deployment Readiness

Deploy project management books you will use the following software

  • nginx
  • uWSGI
  • CentOS7
  • Library management deployment project file
  • virtualenv
  • supervisor

WSGI, uWSGI

python web server development using the WSGI protocol (Web Server Gateway Interface)

python web project will generate a default wsgi.py file to determine a good application module.

Production environment using uWSGI, writing implements WSGI all interfaces, C language, very efficient web server.

uWSGI is a full-featured HTTP server to achieve the WSGI protocol, uwsgi agreement, http agreement. It is to do is to be converted to HTTP protocol language supported network protocols. For example, the HTTP protocol is converted into WSGI protocol, so Python can be used directly.

Nginx

Nginx is to use its reverse proxy feature, the project will be deployed server line by Django + uWSGI + Nginx.

CentOS

1. packaged CRM project folder, file compression

2. xftp, scp, lrzsz such as uploading files to the server Centos

Linux Tips

1. xshell or iTerm software, multi-terminal operation of your linxu, so to uwsgi, nginx, project code debugging time, avoid switching back and forth directory, provide efficiency.

Note 2. Modify the linux software configuration file must restart the service to take effect.

Virtualenv

Build a clean, isolated python interpreter environment, to prevent the problem software dependency, conflict, recommended.

Supervisor

Supervisor (http://supervisord.org/) is developed with a client Python / server services, is a process management tool under Linux / Unix systems, Windows systems are not supported. It can easily monitor, start, stop, restart one or more processes. Supervisor with process management, when a process is killed unexpectedly, supervisort to monitor the process of death, it will automatically pull up again, it is convenient to do the process of automatic recovery functions, eliminating the need to write shell scripts to control.

 

Begin deployment

1, familiar with linux operating

linux basic operation command omitted .....

 

2, python3 interpreter installed

Reference blog: https://www.cnblogs.com/tiger666/articles/10312522.html

 

3, virtualenvwrapper configuration tools, virtual solve environmental problems

# Confirm ~ / .bashrc virtualenvwrapper arranged inside the profile 
WORKON_HOME = ~ / Envs that
VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
VIRTUALENVWRAPPER_PYTHON=/opt/python36/bin/python3
source /opt/python36/bin/virtualenvwrapper.sh

# Create and activate a virtual environment for library management system project 
mkvirtualenv book_manage_env

 

4, installation configuration MariaDB database, and create database data, migrate data import library management system

(1) install and start MariaDB database

In CentOS7, MariaDB is mysql database, just a different package name

# Use yum to download and install MariaDB 
yum install MariaDB MariaDB-Client-Server - the y-

# Start mariadb server 
systemctl start mysql

(2) connected and authorized root users to remotely access

# Use the client to link mysql server 
mysql-uroot-- the p-landing mariadb on linux

# Note 1, linux database, you need to set up a remote link to the root user privileges, password is qishi3q 
Grant All privileges ON * * to root @. ' % ' IDENTIFIED by ' qishi3q ' ;
 # authorize all rights, in all the libraries, All tables for the root user on all hosts, set permissions password is qishi3q 
# refresh authorization form 
flush privileges;

Note 2, linux firewall and selinux to be closed, otherwise windows to linux link port 3306 may be denied

Data (3) import library management project

 

In the data server linux, mysql, import library management system

# Export 1.mysql data, and import 
this command in linux / knock windows in
mysqldump -u root -p --all-databases >  book_manage.dump  

# 2. Upload the data files to the database linux

# 3. mysql Linux are introduced, the data file (in the dump file to specify the database: use szday58) 
mysql the root -p -u </ opt / book_manage.dump
 # or entered into the database in mysql, use the command: 
Source / opt / book_manage.dump

 

5, into the virtual environment and run the project

The test uses linux python interpreter to run the project to switch to the project running (Note To solve the problem interpreter module to the normal operation of the project)

# Use 127.0.0.1 not, can only access this machine, to get everyone to access, you must use 0.0.0.0 
python3 manage.py the runserver 0.0.0.0:8000

Then you can access through IP plus port, if this is my IP cloud server IP, then we went to the interview, you can take this project to show the interviewer on the computer, there is a good format to force ah ~

 

Eggs : There is now a problem, we can access the project through 10.0.0.7:8000, but the public Internet website is not so, ah , such as Luffy Xuecheng, is accessed through the domain name, we can resolve the way out of the fly Xuecheng the server IP, can also be accessed through the address, but no increase port on the rear, because the default port 80 is used

Although we can directly port to 80 no problem, then the question arises: 

1 django run the web interface by default, it wsgiref stand-alone module, the performance will be relatively low, you need to how to solve?

uwsgi + django + nginx

2 We want to rerun a project to provide services, how to do it? Only a 80-port server, how to solve

nginx + uwsgi + django + supervisor

 

 


- to complete the installation of nginx configuration to learn how to configure nginx.conf

- complete uWSGI commands to learn, use uWSGI start knight projects to support multi-process

- complete nginx static file handling library management project

- final results

visit 80 ports nginx, you can find library management page, and ensure the normal static files page

 

Guess you like

Origin www.cnblogs.com/zbj666/p/12184614.html