Giter Club home page Giter Club logo

oopress's Introduction

###简介

oopress是一个静态网站生成工具,使用python开发,用到了markdown、jinja2等第三方库,在Linux下运行稳定。

image

oopress/
├── _extras
│   └── robots.txt
├── gen_site.py
├── _images
│   └── 2014
│       ├── demo.png
│       └── images.jpeg
├── _layouts
│   ├── cat_index.html
│   ├── default.html
│   ├── error.html
│   ├── index.html
│   ├── page.html
│   ├── post.html
│   ├── post_index.html
│   └── tag_index.html
├── _pages
│   ├── 关于oopress.md
│   ├── 留言本.md
│   └── 音乐墙.md
├── _posts
│   └── 2014
│       └── 04
│           ├── 2014-04-11-测试.md
│           ├── 2014-04-18-使用up2yun.py上传oopress到upyun.md
│           └── 2014-04-18-简易指南.md
├── readme.md
├── _site
│   ├── category
│   │   └── index.html
│   ├── error.html
│   ├── images
│   │   └── 2014
│   │       ├── demo.png
│   │       └── images.jpeg
│   ├── index.html
│   ├── post
│   │   ├── 2014
│   │   │   └── 04
│   │   │       ├── 11
│   │   │       │   └── 测试.html
│   │   │       └── 18
│   │   │           └── oopress简易指南.html
│   │   └── index.html
│   ├── robots.txt
│   ├── static
│   │   ├── default.css
│   │   ├── easing.js
│   │   ├── favicon.png
│   │   ├── jquery-1.7.2.min.js
│   │   ├── jquery.js
│   │   ├── jquery.ui.totop.min.js
│   │   ├── prism.css
│   │   ├── prism.js
│   │   ├── style.css
│   │   ├── ui.totop.css
│   │   └── ui.totop.png
│   ├── tag
│   │   └── index.html
│   ├── 关于oopress.html
│   ├── 留言本.html
│   └── 音乐墙.html
├── _static
│   ├── default.css
│   ├── easing.js
│   ├── favicon.png
│   ├── jquery-1.7.2.min.js
│   ├── jquery.js
│   ├── jquery.ui.totop.min.js
│   ├── prism.css
│   ├── prism.js
│   ├── style.css
│   ├── ui.totop.css
│   └── ui.totop.png
├── tool
│   ├── base.py
│   └── __init__.py
├── up2yun.py
└── up2yun.sh

oopress/_site/目录下的内容是生成的网站内容。 在目录oopress/_posts/中写文章(mardown语法),文章应该以下面的形式开头:

---
title:简易指南
layout:post
time:2014-04-18 09:00
author:樂天
cat:oopress
tag:oopress,test
---

:右边是要修改的内容。title指定文章名称;layout制定使用oopress/_layouts下的哪个模板文件;time指定文章书写时间,这个必须要有,且应按照上面示例的形式书写;author指明作者;cat是文章非类;tag是文章标签。上面的文件在构建静态网站时候会生成文件oopress/_site/2014/04/18/简易指南.html

oopress/_page目录下是网站的页面(markdown语法)。文件内容必须如下开头:

---
title:关于oopress
layout:page
time:2014-04-07 18:00
---

这些文件会被转换成html放在oopress/_site/下。

oopress/_extra下的文件会被直接复制到oopress/_site目录下。

oopress/_static下的文件会被直接复制到oopress/static目录下。

oopress/_images下的文件会被直接复制到oopress/images目录下。

###生成网站

在写完文章后,执行:

./oopress/gen_site.py

##如何在本地测试生成的网站

进入_site:

cd oopress/_site
python -m SimpleHTTPServer

打开浏览器访问http://127.0.0.1:8000。

###如何部署到远程主机

rsync -ravzhe  ssh ./oopress/_site [email protected]:/var/www

###如何部署到又拍云 找到oopress/up2yun.py,打开文件在:

if __name__ == '__main__':
    
    bucket_name = 'your-bucket-name'
    user_name = 'your-name'
    passwd = 'your-password'

处配置您的信息。保存文件后: 清空您的bucket:

python up2yun.py clean

上传您的网站内容(oopress/_site)到upyun:

python up2yun.py upload

要运行up2yun.py,请先安装upyun lib:

pip install upyun

up2yun.py在Linux Mint 15下正常运行。 另外,up2yun.sh参考自网络,也应该可以进行上传,但是因网速等原因,oopress/up2yun.sh暂时未测试。

###其他 oopress/.pydevproject、oopress/.project、oopress/.settings是无关文件。

最近可以在http://oopress.b0.upaiyun.com下看到示例。(2014-04-18)

oopress's People

Contributors

letiantian avatar

Watchers

James Cloos avatar  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.