Flaskblog was deployed on the Digitalocean, the project was small, and many things were learned in the deployment.
Operating System selection is Ubuntu14.04, the reason is usually their main use of this version, handy only, so you can choose the appropriate version of Linux as needed.
Deployment Scenarios:
Virtualenv+gunicorn+nginx+supervisor
Download the code for the project from here Flaskblog, with a simple configuration file reference in the project.
You can visit Flaskblog first to see.
Attention
In this article, you use the Ubuntu14.04 64-bit host to create a user named Xin to deploy.
This article focuses on deployment, and all Linux related operations are not described in detail.
The deployment directory is (/home/xin/www/flaskblog), so be aware of the directory in the configuration file.
Environment
System: Ubuntu 14.04 64
Web Server:nginx
Virtual Environment: Virtualenv
WSGI Server:gunicorn
Database: MySQL
Monitor:supervisor
The use of Supervisor is primarily to monitor the operation of the Gunicorn to ensure that the server is continuously operational.
Installation
Installing the Software
$ sudo apt-get install PYTHON-PIP $ sudo apt-get install Python-dev $ sudo pip install virtualenv $ sudo apt-get i Nstall mysql-server $ sudo apt-get install Libmysqlclient-dev $ sudo apt-get install Nginx
Download the project and open the virtual environment
Download code to (/home/xin/www/flaskblog) using Git
$ git clone https://github.com/defshine/flaskblog.git $ cd Flaskblog
Start a virtual environment, install engineering dependencies
$ virtualenv venv $ source venv/bin/activate (venv) $ pip install-r requirements.txt
How to exit a virtual environment
Database
Create a database (Flaskblog) in the MySQL database and modify the configuration of the database in the config.py
Initialize the database and create an administrator user
Turn on monitoring
Under your own circumstances, edit the Supervisor configuration file (flaskblog.conf) under the project and copy it to the system directory
Reload the configuration file and start Flaskblog
View Run status
Nginx
Modify the Nginx configuration file (flaskblog), then copy it to the system directory and create a soft link. Restart Nignx.
View Nginx Status
Then, you can access it by IP address. Of course, the configuration of the domain name, access better.
Flaskblog This small project, just have a small prototype, follow up can also develop some small features.