美文网首页
我的博客

我的博客

作者: 清净一心 | 来源:发表于2021-09-13 19:21 被阅读0次

最近,很想静下心来写点东西,于是,就想到了创建自己的博客。其实,以前也写过一段时间的博客,采用了HEXO的博客框架。但是,很遗憾,没能坚持下来。后来,在学习Python的过程中,无意中浏览到一位博主的博客使用的是Pelican ——一款用Python编写的静态网站生成工具,想到自己原本就一直对Python很感兴趣,于是决定采用Pelican作为自己的博客框架。

由于家中有一台24小时开机的树莓派,可以被随时访问,所以我决定将博客部署在树莓派上。Pelican的初始安装和部署非常简单,通过执行几条简单的命令,就可以完成安装。但是,由于Pelican是用Python编写,所以部署的时候,必须先确保已经安装了Python。

安装Pelican之前,在/home/pi目录下,先新建blog目录,然后进入该目录。

mkdir /home/pi/blog
cd /home/pi/blog

为了能为Pelican创建一个独立的虚拟Python环境,需要先安装virtualenv,然后再创建和激活虚拟环境。

pipx install virtualenv
virtualenv venv
source venv/bin/activate

开始安装Pelican。

python -m pip install pelican

如果要使用Markdown语言,建议使用以下命令安装Pelican。

python -m pip install "pelican[markdown]"

Pelican安装成功后,完成初始配置。

pelican-quickstart

This script will help you create a new Pelican-based website.

Please answer the following questions so this script can generate the files
needed by Pelican.

> Where do you want to create your new web site? [.]
> What will be the title of this web site? Andy's Blog                 //博客的站点名称
> Who will be the author of this web site? Andy                        //博客的作者名称
> What will be the default language of this web site? [English] zh     //博客的语言,zh为中文
> Do you want to enable article pagination? (Y/n) Y
> How many articles per page do you want? [10] 5
> What is your time zone? [Europe/Paris] Asia/Shanghai
> Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) Y
> Do you want to upload your website using FTP? (y/N) N
> Do you want to upload your website using SSH? (y/N) N
> Do you want to upload your website using Dropbox? (y/N) N
> Do you want to upload your website using S3? (y/N) N
> Do you want to upload your website using Rackspace Cloud Files? (y/N) N
> Do you want to upload your website using GitHub Pages? (y/N) y

完成以上配置后,Pelican可以算是初步部署完成了,如果以后要更改相关配置,可以通过文件pelicanconf.py来修改。

好了,下一步就可以直接将写好的文章正式发布到博客了。

相关文章

  • 我的博客

  • 我的博客

    DYL博客已经正式上线。 记录分享自己的学习成果。 希望大家喜欢http://diyiliu.cc。

  • 我的博客

    csdn:https://blog.csdn.net/lsy_666 博客园:http://www.cnblogs...

  • 我的博客

  • 我的博客

    这是我的博客,在这里将记录分享我的知识及见解的输出!

  • 我的博客

    欢迎各位来访我的博客,共同学习提高! My Blog Address On GitHub My Blog Addr...

  • 我的博客

    我的博客地址 简书:http://www.jianshu.com/u/2ac72d92c8c3 CSDN:http...

  • 我的博客

    你好

  • 我的博客

    1.学习了git 学习步骤.进入一个安全的目录,比如 cd ~/Desktop 或者 cd ~/Documents...

  • 我的博客

    搭建在github上 主题Fexo 博客里有主题介绍 欢迎 haobang.me

网友评论

      本文标题:我的博客

      本文链接:https://www.haomeiwen.com/subject/fpwfgltx.html