Skip to content

Sugar-Coder/bluelog

 
 

Repository files navigation

Bluelog

A blue blog.

Example application for Python Web Development with Flask (《Flask Web 开发实战》).

Demo: http://bluelog.helloflask.com

Screenshot

Installation

clone:

$ git clone https://github.com/greyli/bluelog.git
$ cd bluelog

create & activate virtual env then install dependency:

with venv/virtualenv + pip:

$ python -m venv env  # use `virtualenv env` for Python2, use `python3` for Python3 on Linux & macOS
$ source env/bin/activate  # use `env\Scripts\activate` on Windows
$ pip install -r requirements.txt  # use `pip3` for Python3 on Linux & macOS

or with Pipenv:

$ pipenv install --dev
$ pipenv shell

generate fake data then run:

$ flask forge
$ flask run
* Running on http://127.0.0.1:5000/

Test account:

  • username: admin
  • password: helloflask

License

This project is licensed under the MIT License (see the LICENSE file for details).

Deployment by Docker

编写.env文件

FLASK_CONFIG=production
DATABASE_URL=mysql://root:dbpass@mysqldb/blogdb?charset=utf8mb4

MAIL_SERVER=
MAIL_USERNAME=
MAIL_PASSWORD=
BLUELOG_EMAIL=

SECRET_KEY=secret

启动(会创建一个镜像bluelog_app)

$ docker-compose up

对接mysql container,创建数据库 blogdb

$ docker exec -it bluelog_mysqldb_1 mysql -u root -p
# 进入mysql容器
mysql> create database blogdb default character set utf8mb4 collate utf8mb4_unicode_ci;
Query OK, 1 row affected (0.01 sec)

对接bluelog-container,初始化博客

$ docker exec -it bluelog_app_1 bash 
# 进入bluelog容器
root@e7bdaaa29534:/bluelog# flask init --username admin --password 123
Initializing the database...
Creating the temporary administrator account...
Creating the default category...
Done.

访问localhost:8000

About

A blog engine built with Flask.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 39.8%
  • HTML 29.8%
  • Python 8.0%
  • CSS 7.4%
  • SCSS 5.0%
  • Less 5.0%
  • Other 5.0%