Code Monkey home page Code Monkey logo

hblog's Introduction

HBlog

介绍

HBlog是基于Python和Flask的博客系统。

  • 具有博文、博文评论、博文归档的功能。
  • 具有博客留言的功能。
  • 访客注册、角色管理的功能。
  • 文件存储的功能。
  • 具有管理员管理后台。

部署

下载

$ useradd hblog -m
$ git clone https://github.com/SuperH-0630/HBlog.git /home/hblog/.HBlog

下载依赖

$ sudo -u hblog python3.10 -m pip install -r /home/hblog/.HBlog/requirements.txt --user
$ sudo -u hblog python3.10 -m pip install gunicorn gevent --user

配置

创建配置文件etc/hblog/conf.json,配置文件内容如下:

{
  "DEBUG_PROFILE": false,
  "SECRET_KEY": "随机密钥",

  "BLOG_NAME": "",
  "BLOG_DESCRIBE": "",
  "INTRODUCE": {
    "介绍的名称": "可任意创建更多介绍"
  },
  "INTRODUCE_LINK": {
    "连接名称": "可任意创建更多连接"
  },
  "ABOUT_ME_PAGE": "about_me.html静态页面的地址",
  "FOOT": "页脚信息",

  "MYSQL_URL": "",
  "MYSQL_PORT": 3306,
  "MYSQL_NAME": "",
  "MYSQL_PASSWD": "",
  "MYSQL_DATABASE": "",

  "REDIS_HOST": "",
  "REDIS_PORT": 6379,
  "REDIS_NAME": "",
  "REDIS_PASSWD": "",
  "REDIS_DATABASE": 0,

  "CACHE_REDIS_HOST": "",
  "CACHE_REDIS_PORT": 6379,
  "CACHE_REDIS_NAME": "",
  "CACHE_REDIS_PASSWD": "",
  "CACHE_REDIS_DATABASE": 0,

  "MAIL_SERVER": "SMTP服务地址",
  "MAIL_PORT": 465,
  "MAIL_USE_TLS": false,
  "MAIL_USE_SSL": true,
  "MAIL_USERNAME": "",
  "MAIL_PASSWORD": "@0630",
  "MAIL_SENDER": "名字 <发件人地址>",

  "USE_ALIYUN": true,
  "ALIYUN_KEY": "阿里云OOS的账号Key",
  "ALIYUN_SECRET": "",
  "ALIYUN_BUCKET_ENDPOINT": "",
  "ALIYUN_BUCKET_IS_CNAME": false,
  "ALIYUN_BUCKET_NAME": "",
  "ALIYUN_BUCKET_USE_SIGN_URL": false,

  "LOG_LEVEL": "debug",
  "LOG_HOME": "log",
  "LOG_SENDER": true,

  "LOGO": "Logo的文件名,存储在static目录的相对路径",
  "ICP": {
    "备案的域名": "ICP备案"
  },
  "GONG_AN": {
    "备案的域名": "公安备案"
  }
}

静态AboutMe.html页面

一个普通的HTML页面,必须包含<div class="about-me"> </div>,这部分内容会被显示在博客上。

创建systemd服务文件

[Unit]
Description=HBlog server on 8080
After=network.target auditd.service

[Service]
User=hblog
Group=hblog
WorkingDirectory=/home/hblog/.HBlog/
ExecStart=python3.10的路径 -m gunicorn -c /home/hblog/.HBlog/gunicorn.conf.py main:app --preload -b 0.0.0.0:8080
Type=simple
Environment="HBLOG_CONF=/etc/hblog/conf.json"
 
[Install]
WantedBy=multi-user.targe

样例博客

我的博客就是用HBlog搭建的,访问:是桓的小窝

hblog's People

Contributors

superh-0630 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.