A refreshingly simple static site generator, for those who like to work in HTML.
Try it out:
$ pip install complexity
$ git clone email@example.com:audreyr/complexity-example.git my_proj
$ cd my_proj
$ complexity project/ www/
Once you’ve done that, open a web browser to http://127.0.0.1:9090 to see the newly generated Complexity static site.
Best Used With
Complexity is designed to be used with these packages:
- Simplicity: Converts ReStructuredText into JSON, which Complexity can use
- A Lot of Effort: Deploys a static website (e.g. the output of Complexity)
to Amazon S3.
- Cookiecutter: Creates projects from project templates.
Sure, they could have all been built into Complexity, but decoupling them
seemed like a nice thing to do.
- Depend on Jinja2 >= 2.4, not == 2.7.
- USAGE CHANGE: At the command line, Complexity no longer takes an output_dir
argument. It now assumes that your output_dir is www/ by default, but you
can customize it in complexity.json.
- Support for configuration via complexity.json: you can specify any or all
of the following key/value pairs:
for more info.
A couple of small but important renames. If you rely on either of the following
defaults, you will need to rename them in your Complexity project.
- Directory parameter for .json files to be turned into context data has been
renamed from json_dir to context_dir.
- Default context directory value json/ has been changed to context/.
Sometimes you want your .json files to be turned into context variables, and
sometimes you don’t. This rename alleviates confusion when working with
non-context .json files.
- Support for multi-level template directories. (Upgrade to at least 0.6 if
you want to have folders within folders and beyond in templates/.)
- Skip non-HTML files in templates/ rather than raising NonHTMLFileException.
- Improved static site generation API - better parameters are used.
- Files in the root of assets/ (or the asset directory) now get copied over to the output.
- Much more documentation.
- Make reading of JSON files from json/ optional.
- Fix reading of JSON files from json/.
Project layout is now:
├── project/ <--------- input
│ ├── assets/
│ │ ├── css/
│ │ ├── js/
│ │ └── img/
│ ├── json/
│ │ └── stuff.json
│ └── templates/
│ ├── base.html
│ ├── index.html
│ └── about.html
└── www/ <---------- output (generated)
│ └── index.html
Assets are copied over to www/ during site generation.
If the www/ directory was previously created, it prompts the user and then
deletes it before site regeneration.
Templates starting with base are not generated as individual pages. They
are meant to be extended in other templates.
- Graceful shutdown/restart of dev server.
- Required input and output dir arguments.
- Optional port argument.
- Improved server start/stop messages.
- Major internal refactor.
- Data from .json files now gets read as template context data.
- Tested (and passing!) on Python 2.6, 2.7, 3.3, PyPy.