Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ovenx/flask-blog

simple flask blog
https://github.com/ovenx/flask-blog

blog flask python simple

Last synced: about 2 months ago
JSON representation

simple flask blog

Awesome Lists containing this project

README

        

# flask-blog
基于 flask 的极简 blog

## 安装

clone 代码到本地
```shell
git clone https://github.com/ovenx/flask-blog.git
```

安装 virtualenv
```shell
cd flask-blog
python -m venv venv #python3
. venv/bin/activate # venv\scripts\activate(windows)
```

安装依赖
```shell
pip install -r requirements.txt
```

创建数据库,导入数据表
```mysql
create database flask-blog
source flask-blog/schema.sql
```
> 或者可以通过 flask initdb 方式来导入数据表(需要设置FLASK_APP)

创建配置文件,修改数据库配置

```bash
cp config.py.example config.py
```

然后运行
```shell
python run.py
```
>前台地址:http://127.0.0.1:5000

>后台地址:http://127.0.0.1:5000/admin(默认为 admin/admin)

样式修改
```shell
npm install
gulp # gulp watch
```

## 部署

flask 自带的 server 不适用于生产环境,需要使用其它 server 代替,[请参考文档说明](http://flask.pocoo.org/docs/0.12/deploying/#deployment)。
推荐使用 **gunicorn + nginx + supervisor** 方式,[详情参考](https://blog.xiongwentao.me/2020/02/09/flask-blog-deploy/) 。

## 功能

* 分类
* 标签
* 归档
* 分页
* code highlight
* markdown
* toc

## 依赖

* [python3](https://www.python.org/)
* [flask](https://github.com/pallets/flask)
* [mistune](https://github.com/lepture/mistune)
* [pygments](http://pygments.org/)
* [pymysql](https://github.com/PyMySQL/PyMySQL)
* [bootstrap v4](https://github.com/twbs/bootstrap)
* [simplemde-markdown-editor](https://github.com/NextStepWebs/simplemde-markdown-editor)
* [sass](https://github.com/sass/sass)

## TODO

- [x] friendlink
- [ ] 优化界面的自适应
- [ ] 添加 about 页面
- [ ] 后台导出 markdown 文件
- [x] 文章页添加查看 markdown 原文
- [ ] 评论功能,留言本
- [ ] I18N

## LICENSE

MIT