Deploying Flaskblog apps on Digitalocean servers

Source: Internet
Author: User
Tags using git virtual environment virtualenv
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.