Deploy the open-source blog system Blog_mini on Ubuntu

Source: Internet
Author: User
Tags virtualenv

Deploy the open-source blog system Blog_mini on Ubuntu

0. Description
This article is the official deployment document for the open-source blog system Blog_mini. After reading this article, you will be able to fully deploy Blog_mini on a brand new CentOS system, thus successfully setting up your personal blog website.
The operating system used here is Ubuntu 15.10. Theoretically, Blog_mini can be successfully deployed as long as the Python version installed on the operating system is 2.6.x or 2.7.x.

1. Obtain Blog_mini source code

You can obtain the source code of Blog_mini in the following two ways:

Using git

Download from the Blog_mini project Homepage
We will introduce these two methods. In practice, you only need to select one of them. We recommend the first method.

(1) Get the source code through git
First, make sure that your system has installed the git version control system:
Bkjia @ leaf :~ $ Git version
The program "git" has not been installed yet. You can use the following command to install:
Sudo apt-get install git

If no installation is available, install it using apt-get:

Bkjia @ leaf :~ $ Sudo apt-get install git
[Sudo] bkjia password:

After the installation is complete, create a project directory in the user directory:
Bkjia @ leaf :~ $ Mkdir project
Bkjia @ leaf :~ $ Cd project/
Bkjia @ leaf :~ /Project $

Clone the source code from the Blog_mini Project address:
Bkjia @ leaf :~ /Project $ git clone https://github.com/bkjia/Blog_mini

If the network condition is good, the code can be cloned soon.

View the Blog_mini source code directory structure:
Bkjia @ leaf :~ /Project/Blog_mini $ ls
App LICENSE migrations README. md requirements.txt
Config. py manage. py Procfile requirements

(2) download the source code from the Blog_mini project homepage.

If you want to obtain the Blog_mini source code in this way, you 'd better perform operations in the operating system on the GUI, for example, you can download it from a Windows, Mac, or Linux operating system with a GUI, and then upload it to our CentOS operating system.

Go to the project homepage:
Https://github.com/bkjia/Blog_mini
Click Download ZIP.

The downloaded file name should be: Blog_mini-master.zip
After the download is complete, decompress the package and upload it to the Ubuntu operating system. The method (1) Under the source code directory structure of Blog_mini is the same.

2. Install pip

Run the following command to install the SDK:
Bkjia @ leaf :~ /Project/Blog_mini $ sudo apt-get install python-pip

3. Install virtualenv

Run the following command to install the SDK:
Bkjia @ leaf :~ /Project/Blog_mini $ sudo apt-get install virtualenv

If the above Command says that virtualenv cannot be found, use the following command:

Bkjia @ leaf :~ /Project/Blog_mini $ sudo apt-get install python-virtualenv

4. Create a virtual environment venv

Run the following command in the Blog_mini directory:
Bkjia @ leaf :~ /Project/Blog_mini $ virtualenv venv
Running virtualenv with interpreter/usr/bin/python2
New python executable in venv/bin/python2
Also creating executable in venv/bin/python
Installing setuptools, pip... done.

A venv directory is generated under Blog_mini:
Bkjia @ leaf :~ /Project/Blog_mini $ ls
App LICENSE migrations README. md requirements.txt
Config. py manage. py Procfile requirements venv

5. Activate the virtual environment venv

In the Blog_mini directory:
Bkjia @ leaf :~ /Project/Blog_mini $ source venv/bin/activate
(Venv) bkjia @ leaf :~ /Project/Blog_mini $

Check the prompt changes.

6. Install the Blog_mini requirement File

Run the following command:
(Venv) bkjia @ leaf :~ /Project/Blog_mini $ pip install-r requirements/common.txt

It takes some time to install some extension packages required by Blog_mini. Of course, if the network is good, the installation can be completed soon.

Let's take a look at this step. In addition to the database configuration, all the Blog_mini requirement environments have been set up. Next we need to complete one of the following two:
Use sqlite as the default database to run Blog_mini

Use MySQL as the default database to run Blog_mini
You only need to use one of the databases.
If you are a newbie or you just want to quickly build a Blog_mini-based blog website, you can choose the first one because you do not need to make any configuration.
If you know more about MySQL installation and use, and want to achieve better performance, you can choose the second one.
Of course, I will also provide detailed usage instructions below.

7. Use sqlite as the default database to run Blog_mini

Python itself comes with the sqlite database. Therefore, if you want to use sqlite as the default database, you do not need to make any configuration.

The next step is to run Blog_mini.

To generate the default system data required by Blog_mini, run the following command in the Blog_mini directory:
(Venv) bkjia @ leaf :~ /Project/Blog_mini $ python manage. py deploy product
INFO [alembic. runtime. migration] Context impl SQLiteImpl.
INFO [alembic. runtime. migration] Will assume non-transactional DDL.
INFO [alembic. runtime. migration] Running upgrade-> 051691f120e6, fit to MySQL

If the above prompt appears, it means the operation is successful! You don't have to worry about the 'fit to mysql' at the end. This is just a note at the time. It is also useful to indicate that you want to use MySQL later. It doesn't make much sense.

View the generated sqlite database:
(Venv) bkjia @ leaf :~ /Project/Blog_mini $ ls
App config. pyc LICENSE migrations README. md requirements.txt
Config. py data. sqlite manage. py Procfile requirements venv

You can see an additional data. sqlite file. This file is the sqlite database file!

Run Blog_mini:
(Venv) bkjia @ leaf :~ /Project/Blog_mini $ gunicorn manage: app
[11:49:11 + 0000] [7189] [INFO] Starting gunicorn 19.4.5
[11:49:11 + 0000] [7189] [INFO] Listening at: http: // 127.0.0.1: 8000 (7189)
[11:49:11 + 0000] [7189] [INFO] Using worker: sync
[11:49:11 + 0000] [7194] [INFO] Booting worker with pid: 7194

The above prompt indicates that Blog_mini has been successfully run! However, this running mode can only be accessed on port 8000 of the Local Machine. If your Ubuntu operating system does not have a GUI, you cannot access it on the local machine, so we can run it in the following way.

Run Blog_mini on port 80:
(Venv) bkjia @ leaf :~ /Project/Blog_mini $ gunicorn-B 0.0.0.0: 80 manage: app
[11:50:43 + 0000] [7202] [INFO] Starting gunicorn 19.4.5
[11:50:43 + 0000] [7202] [INFO] Listening at: http: // 0.0.0.0: 80 (7202)
[11:50:43 + 0000] [7202] [INFO] Using worker: sync
[11:50:43 + 0000] [7207] [INFO] Booting worker with pid: 7207

In this case:
If you deploy Blog_mini on a server with a public IP address, you only need to enter your public IP address in the browser of any host on the Internet to access Blog_mini.

If you only deploy Blog_mini on the LAN, you can enter the IP address of your host in the browser of any host on the LAN.

However, if the access fails, it may be a firewall problem. You can first turn off the Firewall:

Bkjia @ leaf :~ $ Sudo ufw disable
[Sudo] bkjia password:

Since the bloggers first learned about network engineering, if you encounter any problems in network communication, you can reply to me and I will answer them one by one.

In this step, you have successfully deployed the Blog_mini server, and then you can operate your personal blog website! Blog_mini has powerful functions, but it is very easy to use. You can refer to the blog post about Blog_mini to learn about its functions. Of course, you can also explore it on your own, I believe this is very easy for you!
You must note that Blog_mini supports background management (you can click the 'background management' logon link at the bottom of the home page to go To the logon page). below is the default account password for the Blog_mini Management Background:

Blog_mini@163.com account

Password: blog_mini

Tip: After Blog_mini is deployed, there is no data in it. If you need some data to test the Blog_mini function, you can execute the following command after completing the above operation:
(Venv) bkjia @ leaf :~ /Project/Blog_mini $ python manage. py deploy test_data

This will generate 100 blog posts and 700 comments, as well as the blog classification and System navigation, so that you can easily verify the Blog_mini function.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

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.