[PYTHON] Lektor static site generator

Jinja2 and Flask author, mitsuhiko A static site generator called Lektor was released a while ago published I was doing it, so I did some research.

The chatch sales on the top page

A flexible and powerful static content management system for building complex and beautiful websites out of flat files — for people who do not want to make a compromise between a CMS and a static blog engine.

Getting your ideas implemented is as easy as making breakfast eggs.

A flexible and powerful static content management system for creating complex and beautiful websites from flat files for those who don't want to compromise between CMS or blog engines

It's as easy as making an egg dish for breakfast

[Moongift](http://www.moongift.jp/2015/09/lektor-python%E8%A3%BD%E3%81%AE%E9%9D%99%E7%9A%84%E3%82 % B5% E3% 82% A4% E3% 83% 88% E3% 82% B8% E3% 82% A7% E3% 83% 8D% E3% 83% AC% E3% 83% BC% E3% 82% BF /) But it seems that it was introduced before, but it looks better as the development is progressing a lot.

Unfortunately, it doesn't seem to support python3 yet (it seems that it will be supported in ~~ 2.0. It seems that it was not in time for ~~ 2.0, it seems to be 3.0. (2016-04-16)) Requires Python2.

Install itself is very easy, run a shell script or install with pip.

Now that the installation is complete, check the help with the command.

#lektor --help


Usage: lektor [OPTIONS] COMMAND [ARGS]...

  The lektor management application.

  This command can invoke lektor locally and serve up the website.  It's
  intended for local development of websites.

Options:
  --project PATH   The path to the lektor project to work with.
  --language TEXT  The UI language to use (overrides autodetection).
  --version        Show the version and exit.
  --help           Show this message and exit.

Commands:
  build              Builds the entire project into the final...
  clean              Cleans the entire build folder.
  content-file-info  Provides information for a set of lektor files.
  deploy             Deploy the website.
  dev                Development commands.
  plugins            Manages plugins.
  project-info       Shows the info about a project.
  quickstart         Starts a new empty project.
  server             Launch a local server.

It seems that you can easily start a project by adding quickstart as an option.

# lektor quickstart

Lektor Quickstart
=================

This wizard will generate a new basic project with some sensible defaults for
getting started quickly.  We just need to go through a few questions so that
the project is set up correctly for you.

Step 1:
| A project needs a name.  The name is primarily used for the admin UI and
| some other places to refer to your project to not get confused if multiple
| projects exist.  You can change this at any later point.
> Project Name: "Enter the name of the project"

Step 2:
| Your name.  This is used in a few places in the default template to refer
| to in the default copyright messages.
> Author Name ["Author's name"]:

Step 3:
| This is the path where the project will be located.  You can move a
| project around later if you do not like the path.  If you provide a
| relative path it will be relative to the working directory.
> Project Path ["Project path"]:

Step 4:
| Do you want to generate a basic blog module?  If you enable this the
| models for a very basic blog will be generated.
> Add Basic Blog [Y/n]: Y

That's all. Create project? [Y/n] Y

The project was created immediately, and when I cd to the created folder and executed the tree command, I could see the created file.

tree
.
├── Project name.lektorproject
├── assets
│   └── static
│       └── style.css
├── content
│   ├── about
│   │   └── contents.lr
│   ├── blog
│   │   ├── contents.lr
│   │   └── first-post
│   │       └── contents.lr
│   ├── contents.lr
│   └── projects
│       └── contents.lr
├── models
│   ├── blog-post.ini
│   ├── blog.ini
│   └── page.ini
└── templates
    ├── blog-post.html
    ├── blog.html
    ├── layout.html
    ├── macros
    │   ├── blog.html
    │   └── pagination.html
    └── page.html

10 directories, 16 files

To start the local server, run the following command. To access it, use a browser to access http://127.0.0.1:5000/.

# lektor server

 * Project path:The name of the project.lektorproject
 * Output path: /Users/*****/Library/Caches/Lektor/builds/7f3059dbd1dd5855e861340204aabf2a
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Started source info update
Finished source info update in 0.03 sec
Started build
U index.html
U about/index.html
U projects/index.html
U blog/index.html
U static/style.css
U blog/first-post/index.html
Finished build in 0.10 sec
Started prune
Finished prune in 0.00 sec

To change the settings, go to the admin page at http://127.0.0.1:5000/admin/.

The rest seems to be editable.

If you check setup.py, you can see that it is based on various projects created by mitsuhiko, isn't it?

Jinja2>=2.4 Jinja2 is a full featured template engine for Python. It has full unicode support, an optional integrated sandboxed execution environment, widely used and BSD licensed.

Author trmin Ronacher

click>=6.0 Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It’s the “Command Line Interface Creation Kit”. It’s highly configurable but comes with sensible defaults out of the box.

It aims to make the process of writing command line tools quick and fun while also preventing any frustration caused by the inability to implement an intended CLI API.

Author trmin Ronacher

watchdog Python API library and shell utilities to monitor file system events.

mistune The fastest markdown parser in pure Python, inspired by marked.

Flask Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. And before you ask: It's BSD licensed!

Author trmin Ronacher

EXIFRead Easy to use Python module to extract Exif metadata from tiff and jpeg files.

inifile A small INI library for Python.

Author trmin Ronacher

Babel Babel is an integrated collection of utilities that assist in internationalizing and localizing Python applications, with an emphasis on web-based applications.

setuptools Easily download, build, install, upgrade, and uninstall Python packages

pip The PyPA recommended tool for installing Python packages.

requests Requests is the only Non-GMO HTTP library for Python, safe for human consumption.

Recommended Posts

Lektor static site generator
I made my own primitive static site generator
generator
Easy procedure to start blogging with Python's static site generator "Pelican"
Generator