Giter Site home page Giter Site logo

eudicots / cactus Goto Github PK

View Code? Open in Web Editor NEW
3.5K 124.0 316.0 1.11 MB

Static site generator for designers. Uses Python and Django templates.

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.18% Python 96.46% HTML 3.23% CSS 0.10% JavaScript 0.02%

cactus's Introduction

Build Status

News

Cactus 3 is out!

We're happy to announce Cactus 3. It brings a set of great new features like asset fingerprinting, an asset pipeline, pretty urls, native Mac filesystem events, automatic nameserver configuration, support for multiple deployment backends (Google Sites) and more. Large parts of the code have been rewritten, accompanied by an extensive suite of unit tests. Many thanks to Thomas Orozco and other contributors.

What is Cactus

Cactus is a simple but powerful static website generator using Python and the Django template system. Cactus also makes it easy to develop locally and deploy your site to S3 directly. It works great for company, portfolio, personal, support websites and blogs.

To get a quick overview watch this short video tutorial.

Cactus is based on the idea that most dynamic features on websites these days can be done using Javascript while the actual site can stay static. Static websites are easy to host and typically very fast.

I developed Cactus because I wanted a standard, easy system that designers at Sofa could use to build and deploy fast websites. So typical users would be designers that are tech-savvy, want to use templates, but don't like to mess with setting up django or S3.

Since then it has evolved quite a bit with a plugin system that supports blogging, spriting, versioning and is extensible.

You can find more discussion about static site generators in this Hacker News discussion.

Examples

There is also an example blog project included.

Super quick tutorial for the impatient

Install Cactus with the following one liner

sudo easy_install cactus

If you saw no errors, you can now generate a new project

cactus create ~/www.mysite.com

To start editing and previewing your site type the following. Then point your browser to localhost:8000 and start editing. Cactus will automatically rebuild your project and refresh your browser on changes.

cd ~/www.mysite.com
cactus serve

Once you are ready to deploy your site to S3 you can run the following. You will need your Amazon access keys. If you don't have one yet, read how to get one here.

cactus deploy

Voila. Your website generated by Cactus and hosted on S3!

Extended guide

Creating a new project

You can create a new project by generating a new project structure like this. Make sure the destination folder does not exist yet.

cactus create [path]

If you did not see any errors, the path you pointed to should now look like this.

- .build                Generated site (upload this to your host)
- pages                 Your actual site pages
    - index.html
    - sitemap.xml
    - robots.txt
    - error.html        A default 404 page
- templates             Holds your django templates
    - base.html
- static                Directory with static assets
    - images
    - css
    - js
- plugins               A list of plugins. To enable remove disabled from the name

Making your site

After generating your site you can start building by adding pages to contents, which can rely on templates. So for example if you want a page /articles/2010/my-article.html you would create the file with directories in your pages folder. Then you can edit the file and use django's template features.

Building your site

When you build your site it will generate a static version in the build folder that you can upload to any host. Basically it will render each page from your pages folder, copy it over to the build folder and add all the static assets to it so it becomes a self contained website. You can build your site like this:

cd [your-cactus-path]
cactus build

Your rendered website can now be found in the (hidden) [path]/.build folder. Cactus can also run a small webserver to preview your site and update it when you make any changes. This is really handy when developing to get live visual feedback.

You can run it like this:

cactus serve

Linking and contexts

Cactus makes it easy to relatively link to pages and static assets inside your project by using the template tags {% static %} and {% url %}. For example if you are at page /blog/2011/Jan/my-article.html and would like to link to /contact.html you would write the following:

<a href="{% url '/contact.html' %}">Contact</a>

Just use the URL you would normally use: don't forget the leading slash.

Templates

Cactus uses the Django templates. They should be very similar to other templating systems and have some nice capabilities like inheritance. In a nutshell: a variable looks like this {{ name }} and a tag like this {% block title %}Welcome{% endblock %}. You can read the full documentation at the django site.

Enabling Plugins

To enable a plugin for your site, change the file name from [PLUGIN].disabled.py to [PLUGIN].py.

Deploying

Cactus can deploy your website directly to S3, all you need are your Amazon credentials and a bucket name. Cactus remembers these in a configuration file name config.json to make future deploys painless. The secret key is stored securely in the Keychain or similar services on other OSs.

cactus deploy

After deploying you can visit the website directly. Cactus also makes sure all your text files are compressed and adds caching headers.

Extras

Blogs

For the full example of how to build a blog on top of Cactus, see CactusBlog.

Blog plugin takes post title, author, and date from metadata. For example:

title: My first post
author: Koen Bok
date: 22-07-2012

{% extends "post.html" %}
{% block body %}

{% endblock %}

Modify config.json to set a custom blog path, default author name, or date pattern used to parse metadata. The defaults are:

"blog": {
    "path": "blog",
    "author": "Unknown",
    "date-format": "%d-%m-%Y"
}

YAML Variables

By default you can declare variables to be included above each page, for example:

test_text: Lorem Ipsum

<p>{{ test_text }}</p>

You can declare the variables using YAML instead. Just surround the block with the --- and ... Document Separators. Then the objects and arrays will be available inside the templates:

---
header_text: Lorem Ipsum
custom_object:
  name: Lorem
  description: Ipsum
custom_array:
  -
    name: lorem
  -
    name: ipsum
...

{% for item in custom_array %}
  <p>{{ header_text }}: {{ item.name }}</p>
{% endfor %}

<p>{{ custom_object.name }} | {{ custom_object.description }}</p>

The PyYAML library is used for this functionality.

Asset pipeline

Cactus comes with an asset pipeline for your static files. If you'd like to use it, make sure you use the {% static %} template tag to link to your static assets: they might be renamed in the process.

Fingerprinting

Modify config.json, and add the extensions you want to be fingerprinting:

"fingerprint": [
    "js",
    "css"
],

This lets you enable caching with long expiration dates. When a file changes, its name will reflect the change. Great for when you use a CDN.

Optimization

Modify config.json, and add the extensions you want to be optimizing:

"optimize": [
    "js",
    "css"
],

By default, Cactus will use:

  • YUI for CSS minification
  • Closure compiler for JS minification (YUI is built-in too, so you can use it!)

Check out plugins/static_optimizes.py in your project to understand how this works. It's very easy to add your own optimizers!

Site URL

If you would like for your sitemap to have absolute paths you need to add a site-url key to your config.json

You can enable this by adding modifying your configuration and adding:

"site-url": "http://yoursite.com",

Note that you need to do this if you want your sitemap to be valid for Google Webmaster Tools.

"Pretty" URLs

If you would like to not have ".html" in your URLs, Cactus can rewrite those for you, and make "/my-page.html" look appear as "/my-page/", by creating the "/my-page/index.html" file.

You can enable this by adding modifying your configuration and adding:

"prettify": true

Note that if you're going to use this, you should definitely set your "Meta canonical" to the URL you're using so as to not hurt your search rankings:

<link rel="canonical" href="{{ CURRENT_PAGE.absolute_final_url }}" />

Nameserver configuration

To set up a hosted zone and generate the correct nameserver records for your domain, make sure your bucket is a valid domain name, and run:

cactus domain:setup

Cactus will return with a set of nameservers that you can then enter with your registrar. To see the list again run:

cactus domain:list

If your domain is 'naked' (eg. without www), Cactus will add create an extra bucket that redirects the www variant of your domain to your naked domain (so www.cactus.com to cactus.com). All the above is Amazon only for now.

Extra files

Cactus will auto generate a robots.txt and sitemap.xml file for you based on your pages.

This will help bots to index your pages for Google and Bing for example.

Python Versions

Cactus is tested on Python 2.6, 2.7, 3.4 and 3.5. It probably works on Python 3.3 as well.

cactus's People

Contributors

153957 avatar aardweb avatar alir3z4 avatar antons avatar blattms avatar bnjmn avatar chaudum avatar dangayle avatar dwightgunning avatar eillarra avatar fcurella avatar ibarria0 avatar jaapverloop avatar jammon avatar jbonta avatar joegermuska avatar jonklo avatar kartoch avatar klaaspieter avatar koenbok avatar koobs avatar krallin avatar m-thielen avatar mindthefrog avatar pjv avatar pradyunsg avatar robertjpayne avatar rryan avatar sneak avatar zubietaroberto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cactus's Issues

cactus create --skeleton=/path/to/my/templates

Cactus looks pretty cool, but part of what we're looking for when we found it is a way to consistently start projects with a common base template, CSS/JS stuff, etc.

I'm considering implementing something that passes options to cactus create to support this. My thought is first, to replace the simple CLI parsing with (argparse)[http://docs.python.org/2/library/argparse.html], and then to pass options to the create method. I'm guessing one option would be a completely alternative root, which would be used in place of the 'skeleton' dir in the package distribution (or possibly in addition to? opinions on that?) and maybe another set of options that would allow people to override only some of those directories. Probably something like:
cactus create --pages=/path/to/pages --static=/path/to/static
where only the specified dirs would be copied.

It would also be neat if you could pull the files from a URL like you can with (django-admin.py startproject [https://docs.djangoproject.com/en/dev/ref/django-admin/#startproject-projectname-destination] -- although that seems challenging.

anyway, thought I'd throw this out before I get too far in case people have opinions or objections. Not that I wouldn't do it, but i wouldn't worry about making a pull request which would be accepted....

SCSS files aren't rebuilt when .scss files change (v3 branch)

Changing SCSS files doesn't seem to update the compiled CSS files when the SCSS plugin is activated and cactus is watching the directory as a server (ie. cactus serve).

Looking at the project files, it appears the compiled CSS files are never compiled in either static/css or .build/static/css when cactus serve is running even though the standard build message (*** Rebuilding (/path/to/project changed)) is displayed in the console.

Furthermore, the SCSS files are compiled to CSS files when non-SCSS (e.g. .html) files are saved, when the server is launched (cactus serve) or relaunched (via quitting the server with CTRL+C and restarting with cactus serve).

My expectation would be that SCSS files are compiled to CSS when a .scss file is saved.

Happy to help debug in any way that I can. I spent a little bit of time digging through the cactus source to try to find a place to start and submit a patch but I'm a bit stuck so I thought I'd try submitting an issue.

Remove scss files from the .build

Is there any reason that the scss files are also copied to the build directory?
If not, wouldn't it be better to just remove them from the .build/static/css directory?

How can i access the body of a post with the blog plugin

Would love to put the content of the most recent post on the front page, but find within the blog.py plugin can't access the content of my post and I'm not seeing it as one of the values.

The page object has access to the rendered and raw versions, but that includes all the cruft around the base extend.

This system is great by the way

Warning appearing with Compass v1.0.0.RC1

Since it's a RC from Compass I don't know if it's an issue to check but here it goes:

I'm working with the Cactus Mac App on Mavericks 10.9.4

Ruby Gems Installed:

  • compass (1.0.0.rc.1)
  • compass-core (1.0.0.rc.1)
  • compass-import-once (1.0.5)
  • sass (3.3.14)

When I run compas compile from the Mac terminal it works fine. But the Cactus console is showing me a weird error:

screen shot 2014-08-10 at 1 27 43

/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:128:in `require': cannot load such file -- sass/script/node (LoadError)

The Cactus Mac App does not compile the file with the command at the plugin default.py, but when I run the same command at the Mac terminal it works.

The warning does not appear when I use:

  • compass (0.12.7)
  • compass-core (1.0.0.rc.1)
  • compass-import-once (1.0.5)
  • sass (3.2.19)

UPDATE 1: With Cactus terminal v2.3.1 and v3 Compass1.0.0.RC1 works fine, even the errors are shown correctly.

cactus_terminal_2

cactus_terminal

Python 3 support

Is this on the roadmap? What problems are in making this happen?

instructions for setting up cactus environment

Hi, sorry to be dense, but following the readme docs in cactus and your cactus blog example repo (slightly modified by having installed cactus into a virtual environment), i end up with a big, ugly traceback ending with ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

what i'd like to accomplish is to install cactus into a python venv, ideally such that i can run the latest and greatest by just keeping a git repo up to date, and then get the blogging environment set up which i apparently don't grok how to do correctly.

any pointers on setting things up intelligently, beyond what is in the readme would be very appreciated.

Why markdown2 vs markdown?

Cactus is amazing, but I'm curious as to the choice of markdown2 over the original python markdown? There's the impression that markdown2 is faster than markdown, but this is simply not true, e.g.:
http://lepture.com/en/2014/markdown-parsers-in-python
trentm/python-markdown2#154

I've used both and vastly prefer the original markdown - it's much simpler to write plugins/mods for python-markdown as it's built to be extensible. (This is critical for things like Mathjax, where you need to tweak the parsing/transform order to preserve mathematical content.)

Readme has create syntax wrong

the readme says that the "create" syntax is cactus [path] create but i believe that it is cactus create [path]

that's in the extended guide part of the readme. the syntax is correct in the quick tutorial section.

Blog plugin doesn't work due to django.contrib.markup deprecation

Hi all,
I'm trying to use blog plugin on site hosted on gh-pages and I get the following error:

$ cactus serve
No configuration file found at config.json
Traceback (most recent call last):
  File "/usr/local/bin/cactus", line 9, in <module>
    load_entry_point('Cactus==3.0.0', 'console_scripts', 'cactus')()
  File "/usr/local/lib/python2.7/dist-packages/cactus/cli.py", line 114, in main
    args.target(**{k: v for k, v in vars(args).items() if k != 'target'})
  File "/usr/local/lib/python2.7/dist-packages/cactus/cli.py", line 54, in serve
    site.serve(port=port, browser=browser)
  File "/usr/local/lib/python2.7/dist-packages/cactus/site.py", line 440, in serve
    self.build()
  File "/usr/local/lib/python2.7/dist-packages/cactus/site.py", line 240, in build
    self.plugin_manager.preBuild(self)
  File "/usr/local/lib/python2.7/dist-packages/cactus/plugin/manager.py", line 31, in call
    _meth(*args, **kwargs)
  File "/home/claudyus/code/LXC-Web-Panel/gh-pages/site-src/plugins/blog.py", line 54, in preBuild
    postContext['body'] = getNode(get_template(page.path), name="news")
  File "/usr/lib/python2.7/dist-packages/django/template/loader.py", line 138, in get_template
    template, origin = find_template(template_name)
  File "/usr/lib/python2.7/dist-packages/django/template/loader.py", line 121, in find_template
    loader = find_template_loader(loader_name)
  File "/usr/lib/python2.7/dist-packages/django/template/loader.py", line 94, in find_template_loader
    TemplateLoader = import_by_path(loader)
  File "/usr/lib/python2.7/dist-packages/django/utils/module_loading.py", line 21, in import_by_path
    module = import_module(module_path)
  File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/usr/lib/python2.7/dist-packages/django/template/loaders/app_directories.py", line 25, in <module>
    raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError django.contrib.markup: No module named markup

In https://docs.djangoproject.com/en/1.7/internals/deprecation/ the django.contrib.markup was deprecated in Django=1.6 while pip install cactus installer Django=1.6.1

How to around the issues?

$ sudo pip install cactus 
Requirement already satisfied (use --upgrade to upgrade): cactus in /usr/local/lib/python2.7/dist-packages
Downloading/unpacking Django==1.5.5 (from cactus)
  Downloading Django-1.5.5.tar.gz (8.1MB): 8.1MB downloaded
  Running setup.py (path:/tmp/pip_build_root/Django/setup.py) egg_info for package Django

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
Requirement already satisfied (use --upgrade to upgrade): markdown2 in /usr/local/lib/python2.7/dist-packages (from cactus)
Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.7 (from cactus)
Requirement already satisfied (use --upgrade to upgrade): keyring in /usr/lib/python2.7/dist-packages (from cactus)
Requirement already satisfied (use --upgrade to upgrade): boto>=2.4.1 in /usr/lib/python2.7/dist-packages (from cactus)
Downloading/unpacking tornado>=3.2 (from cactus)
  Downloading tornado-4.0.1.tar.gz (314kB): 314kB downloaded
  Running setup.py (path:/tmp/pip_build_root/tornado/setup.py) egg_info for package tornado

Requirement already satisfied (use --upgrade to upgrade): colorlog in /usr/local/lib/python2.7/dist-packages (from cactus)
Requirement already satisfied (use --upgrade to upgrade): certifi in /usr/local/lib/python2.7/dist-packages (from tornado>=3.2->cactus)
Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in /usr/local/lib/python2.7/dist-packages (from tornado>=3.2->cactus)
Installing collected packages: Django, tornado
  Found existing installation: Django 1.6.1
    Uninstalling Django:
      Successfully uninstalled Django
  Running setup.py install for Django
    changing mode of build/scripts-2.7/django-admin.py from 644 to 755

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
    changing mode of /usr/local/bin/django-admin.py to 755


    ========
    WARNING!
    ========

    You have just installed Django over top of an existing
    installation, without removing it first. Because of this,
    your install may now include extraneous files from a
    previous version that have since been removed from
    Django. This is known to cause a variety of problems. You
    should manually remove the

    /usr/lib/python2.7/dist-packages/django

    directory and re-install Django.

  Found existing installation: tornado 3.1.1
    Uninstalling tornado:
      Successfully uninstalled tornado
  Running setup.py install for tornado
    building 'tornado.speedups' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c tornado/speedups.c -o build/temp.linux-x86_64-2.7/tornado/speedups.o
    tornado/speedups.c:49:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
     initspeedups() {
     ^
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/tornado/speedups.o -o build/lib.linux-x86_64-2.7/tornado/speedups.so

Successfully installed Django tornado
Cleaning up...

Where is config.json?

In the docs you mention a config.json file, but when I cactus create <foo>, there is no config file created. Where does it go?

Can't install via easy_install

Punching in sudo easy_install cactus in the Terminal, isn't working out. Here is the problem:

Searching for cactus
Reading http://pypi.python.org/simple/cactus/
Best match: Cactus 2.2.1
Downloading https://github.com/koenbok/Cactus/tarball/v2.2.1#egg=Cactus-2.2.1
error: Can't download https://github.com/koenbok/Cactus/tarball/v2.2.1: 404 Not Found

Server hangs for 1-2 minutes on every request

For some reason cactus serve on my Mac works terribly slow – server hangs for ~2 minutes before responding.

Replacing ForkingMixin with ThreadingMixin fixes the problem for me.

Python 2.7.1, OS X 10.7.4

Cactus builds all pages including text editor backup files

Cactus is building all files in my pages/ directory including text editor backup files with a tilde suffix, e.g. index.html~ as created by my Emacs and gedit text editors.

It would be great if cactus would just skip building those files when running cactus serve.

Thanks

Allow non-html/md Content in pages folder

In general it is a good idea to have a separate folder for static content, but for what is a static site generator, forcing this is not a good idea in my opinion.

In my current jekyll powered site I have folders that are self contained, contains images, css, minified js along with html, using relative paths. I would like to continue to do this, but currently adding binary file in pages in not supported.

I suggest we do metadata based template handling only on .html files. If my suggestion in issue # 15 goes through .md files etc would be converted to .html before we start processing files so it would handle all markups.

How to deploy locally?

Right now there is only cactus deploy to deploy on Amazon S3, is there anyway to deploy locally, i.e. generate HTML locally so that one can upload it to his own server?

Could not call YUICSSOptimizer/ClosureJSOptimizer

When I run cactus build or cactus serve, I get errors related to my use of optimize in config.json:

Could not call external processor YUICSSOptimizer: [Errno 2] No such file or directory
Could not call external processor ClosureJSOptimizer: [Errno 2] No such file or directory

When I load up a console, importing them like static/static_optimizers.py does loads them no problem, so I don't know what I'm doing wrong.

>>> from cactus.contrib.external.yui import YUICSSOptimizer`

I'm using the v3 branch.

My config.json:

{
    "fingerprint": [
        "js",
        "css"
    ],
    "optimize": [
        "js",
        "css"
    ],
    "prettify": true
}

Rackspace region support

Any plans to support non-default Rackspace regions? We would like to deploy to Sydney but don't see any way to do so. Thanks!

Boto Compatibility for Cactus

I am one of the maintainers of Boto. A few weeks ago we began to merge backward-compatible Python 3.3 and 3.4 support into our develop branch. Most modules now support Python 3 with passing unit and integration tests, and I am hoping to do a release soon. I am reaching out to you to ask if you would test our develop branch with Cactus.

Testing against Python 2.x will help to ensure that we don't accidentally break third party modules like Cactus. If you would like, you may also try out the Python 3 support and let us know any feedback. More information about the Python 3 support can be found in this boto-users post:

https://groups.google.com/forum/#!topic/boto-users/vcvoy8zrfP8

I appreciate any time that you can put into helping the Boto project with this.

This request is part of boto/boto#2437

Keychain mangement fails on Linux

cactus deploy works but gives the following error on Linux (and fails to store AWS private key):

sh: 1: security: not found

It's a shame to have this simple issue because all the rest works flawlessly.

I see it's because Cactus assumes it's running on Mac and uses OS X security command to store the password. Could we release this assumption (checking sys.platform or something). Also, why not support keeping the private key on config.json? Is it because of some security policy?. It could also be handy to support the standard environment variables (ie. AWS_SECRET_ACCESS_KEY) which boto does by default, but that behavior is overridden.

internationalisation

Feature request: use the django translation mechanisms, via the {% trans %} tag and friends, to create multilingual sites.

Need to specify which languages, and where to create the built sites (eg build/en/ and build/fr/ perhaps?).

Should be as simple as (ha!) looping over the languages, setting the language, and rendering the pages into the right location.

That should cover html, not sure about Javascript...

More deployment options

While I love what y'all have done for deploying to S3, it'd be great to have more options for deployment. These could be set via the config.

Temporary file location broken on windows

If I run cactus
from the command line without any arguments then I get the expected
help function. However, if I try to create a new site I get the
following:

$ cactus create some_random_site_name
Traceback (most recent call last):
File "C:\Python27\Scripts\cactus-script.py", line 8, in
load_entry_point('cactus==2.1.3', 'console_scripts', 'cactus')()
File "C:\Python27\lib\site-packages\cactus-2.1.3-py2.7.egg\cactus\cli.py",
line 72, in main
create(option1)
File "C:\Python27\lib\site-packages\cactus-2.1.3-py2.7.egg\cactus\cli.py",
line 20, in create
site.bootstrap()
File "C:\Python27\lib\site-packages\cactus-2.1.3-py2.7.egg\cactus\site.py",
line 78, in bootstrap
f = open(tempSkeletonPath, 'w')
IOError: [Errno 2] No such file or directory: '/tmp/skeleton.tar.gz'

I'm using Windows 8 and don't recall seeing any error message when
installing cactus. I've tried running this in both the Windows command
prompt and Cygwin

Remove S3 Stuff

I feel s3cmd is easy enough, s3cmd sync --acl-public --guess-mime-type .build s3://{MY-BUCKET}/. Site.upload() is one of the biggest methods in Site class and it is does less than s3cmd sync. We may put s3cmd as an optional dependency and update cli.py to call it instead of calling site.upload().

We can then think of maybe supporting a few more things, rsync, sftp etc as part of cli.py.

ERROR: Cannot load compass.

I am not even using compass, I am using bourbon from one of the Template that you have in the Templates repos and I am getting ERROR: Cannot load compass.

screen shot 2014-04-05 at 10 38 36 pm

How does the Markdown plugin work?

First of all, awesome super simple static generator.

I'm confused as how the markdown plugin works, it seems that you need to add the 'extends' and 'block' meta values at the top of your .md file but I can't seem to get anywhere.

What needs to be present for it to work?

Deployment to AppEngine?

no offence to S3 but with the free threshold on AppEngine it would be great to have an option to deploy to there rather than S3. I'll admit to not having spent much time with Cactus yet so not sure how big a job it would be, but just something to consider.

support themes

I think we should not just worry about plugins, but also about themes. Themes would be a bit more complicated because of static assets going to a different location compared to html files. May be we can do a themes folder, that contains a folder for each theme, and theme specific folder contains two folders, templates and static. We select the theme in _config.yaml and put the theme specific folder at the beginning of django's templatedirs setting, and copy theme specific setting file to global static folder static/themename/ folder.

www.example.com
   + pages
   - _config.yaml
   - themes
      + default
      + twitter
      - the-minimum
          - _config.yaml <- merge this file to site _config.yaml if present
          + templates
          + static
    + templates
    - static
         + the-minimum [content of themes/the-minimum/static]

custom django templatetags libraries

Once # 30 is merged, the following diff implements this feature.

diff --git a/cactus/models.py b/cactus/models.py
new file mode 100644
index 0000000..e69de29
diff --git a/cactus/site.py b/cactus/site.py
index 0650d8f..f6e1f35 100644
--- a/cactus/site.py
+++ b/cactus/site.py
@@ -61,7 +61,9 @@ class Site(object):
                        logging.exception("Caught exception while opening config file")
                        config = {}

-               config.setdefault("INSTALLED_APPS", []).append("django.contrib.markup")
+               config.setdefault("INSTALLED_APPS", []).extends(
+                       ["django.contrib.markup", "cactus"]
+               )
                config.setdefault("TEMPLATE_DIRS", []).extend(
                        [self.paths['templates'], self.paths['pages']],
                )
@@ -358,6 +360,7 @@ class Site(object):
                        # Set an id based on the file name
                        plugin.id = pluginHandle

+                       sys.modules["cactus.templatetags.%s" % pluginHandle] = plugin
                        plugins.append(plugin)

                # Sort the plugins by their defined order (optional)
diff --git a/cactus/templatetags/__init__.py b/cactus/templatetags/__init__.py
new file mode 100644
index 0000000..e69de29

It is a bit hacky, I am making cactus project itself a valid django app by adding cactus.models module and cactus.templatetags package. Then I am putting all plugins available as cactus.templatestags.PLUGIN_NAME, Sample plugin, plugins/t.py:

from django import template
import random

register = template.Library()

@register.filter
def randomize(value):
    return "".join(random.sample(value, len(value)))

To use it in template:

{% extends "base.html" %}
{% load t %}
{% block content %}
    {{ "Welcome to Cactus!"|randomize }}
{% endblock %}

I thought of some naming convention for plugins, so only some plugins are added to cactus.templatetags.PLUGIN_NAME, but rejected it as now I can ship a blog plugin that contains both plugin hooks and custom templatetag libraries all related to blogging, list of posts etc.

Bootstrap SCCS

After I drop the Bootstrap Folder with scss files in the static files, I get this ERROR

screen shot 2014-03-23 at 6 23 23 pm

/Library/Python/2.7/site-packages/pyScss-1.2.0.post3-py2.7.egg/scss/init.py:86: RuntimeWarning: Scanning acceleration disabled (_speedups not found)!
RuntimeWarning

Error: Could not load plugin at path /Users/Luis/Desktop/bs-test/plugins/scss.py
Error evaluating expression:
$alert-padding

From <string '//\n// Alerts\n// ----------------------------------'...>:1
Traceback:
File "/Library/Python/2.7/site-packages/pyScss-1.2.0.post3-py2.7.egg/scss/expression.py", line 130, in evaluate_expression
return ast.evaluate(self, divide=divide)
File "/Library/Python/2.7/site-packages/pyScss-1.2.0.post3-py2.7.egg/scss/expression.py", line 359, in evaluate
raise SyntaxError("Undefined variable: '%s'." % self.name)
SyntaxError: Undefined variable: '$alert-padding'.

error: README.md: No such file or directory

When installing cactus as advised, I see the error listed below.
$ sudo easy_install ~/Downloads/koenbok-Cactus-v2.1.0-1-ga53a9a4.zip
Processing koenbok-Cactus-v2.1.0-1-ga53a9a4.zip
Writing /tmp/easy_install-GMBxiW/koenbok-Cactus-a53a9a4/setup.cfg
Running koenbok-Cactus-a53a9a4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-GMBxiW/koenbok-Cactus-a53a9a4/egg-dist-tmp-vyX3oo
error: README.md: No such file or directory

This is quite right as the file in the zip is readme.md (i.e. lowercase) but the setup.py script is looking for the uppercase filename.

How should I approach adding monthly blog index pages?

I'd like a monthly archive index page to be generated for each month for which blog posts exist.

I'm thinking of adding this functionality to the blog.py plugin in the skeleton template.

Is there a better way to approach this? Would you recommend, for example, that I create a new plugin?

The difference is that these pages won't exist in the pages directory -- they'll exist only as rendered pages in the .build directory. I'm not sure how this best fits.

I'd love any advice you can offer. Thanks!

update readme with working install instructions for the latest release

The current install instructions "sudo easy_install cactus" do not download the latest release. The v2.2.0 a50b381 release is downloaded and not the newer 2.2.0 9f12e1b release that fixes the version 2.1.3 typo.
Also I would suggest replacing easy_install with "sudo pip install cactus".

And since there have been a number of bug fixes since the last release it might be nice to include instructions on how to download and install the latest "development version" from the master branch.
This is what I did:
"pip install https://github.com/koenbok/Cactus/tarball/master#egg=Cactus-master"

`cactus export` option?

Not sure if it's there already, but I looked and couldn't find it. What I'm looking for is something like the File › Export… option in Cactus for Mac, but for the command line interface.

Thanks in advance : )

Error embedding stylesheet when regenerating sites using restructuredtext template tag

When I run cactus serve on a site using the restructuredtext template tag, the page fails to rebuild due to the following error:

Building index.html<string>:: (ERROR/3) Cannot embed stylesheet '../env/lib/python2.7/site-packages/docutils/writers/html4css1/html4css1.css': No such file or directory.
*** Error while building[Errno 2] No such file or directory: '../env/lib/python2.7/site-packages/docutils/writers/html4css1/template.txt'

It looks like docutils is using a relative path to embed its stylesheets. The regeneration fails because Cactus changes its working directory using os.chdir() prior to serving pages.

Extra whitespace in built static website

After having installed Cactus via easy_install and serving the site locally, I navigated to the local site in my browser. When I view the page source of index.html, there appears to be extra whitespace surrounding the body content.

Here's what I see:
screenshot 2014-05-23 07 12 22

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.