Flask-based implementation of gitbook-like projects: beibq

Time:2019-9-11

Project source: https://github.com/chaijunit/…

Beibq is an open source book blog based on flask.

Because many blog systems are mainly in the form of articles; if more articles are recorded, they need to be categorized, and it will be more difficult to find a previous article.

Bebq is a way to write a blog by writing books, because books themselves have the function of classification, even if the contents of the records become more, it is not confused, and when reading, it is convenient to switch to other chapters by clicking on the book catalogue.

Installation configuration

Flask-based implementation of gitbook-like projects: beibq

After the website is built, the configuration interface will appear when the browser is used to access it.

Writing books online

Flask-based implementation of gitbook-like projects: beibq

Bebq’s editor supports Markdown. Markdown is a markup language that requires only a few simple markup symbols to transform into rich HTML formats, especially for blogging. Specific Introduction to Markdown: Markdown Grammar Description

Bebq’s editor interface is simple and easy to operate. It can input Markdown markers through toolbars or shortcuts to improve writing efficiency. The editor’s catalog area supports dragging chapters and can adjust the order of chapters.

Editor example: online book writing

Bebq’s editor is a pure JS implementation, and I’ll open it up separately: bookeditor

When you have written a book and click on it to publish it, you can see the latest book trends on the home page.

Flask-based implementation of gitbook-like projects: beibq

Interface

The interface of beibq is simple, beautiful and easy to use. When reading a blog, like reading a book, the interface contains a Book catalog, so that you can easily switch to other chapters by clicking on one chapter of the catalog.

Flask-based implementation of gitbook-like projects: beibq

In order to improve the efficiency of switching chapters, when clicking on a chapter in the catalog and asynchronously requesting chapter content through ajax, it can not only improve the page refresh speed, but also have a good reading experience.

In fact, using Ajax asynchronous request chapters will cause a problem, when the network delay is high, users click on multiple chapters in a short time, which will lead to confusion in page display. To solve this problem, I designed a queue to cache the event when users click on chapters into the queue, if they receive multiple click events in a short time. I actually only request the last event in the queue.

Bebq also automatically adapts the mobile interface, allowing users to read on mobile devices.

Installation and use

1. Install MySQL

Bebq uses mysql, which needs to be installed before installation.

I’m using centos, and the installation method can refer to this document: Installing MySQL on Linux Using the MySQL Yum Repository

2. Installing dependency packages

pip install -r requirements.txt

3. Start the program

python manage.py runserver -h 0.0.0.0

4. Configuring Sites

Enter http://127.0.0.1:5000 in the browser

The first visit will jump to the configuration interface, and you can use beibq after configuring site information according to instructions

Recommended Today

Hadoop MapReduce Spark Configuration Item

Scope of application The configuration items covered in this article are mainly for Hadoop 2.x and Spark 2.x. MapReduce Official documents https://hadoop.apache.org/doc…Lower left corner: mapred-default.xml Examples of configuration items name value description mapreduce.job.reduce.slowstart.completedmaps 0.05 Resource requests for Reduce Task will not be made until the percentage of Map Task completed reaches that value. mapreduce.output.fileoutputformat.compress false […]