Backends¶
Backend classes which all implement a save method with the following signature:
save(html, target)
The target can be a string specifying a target path, or some other kind of object. The arguments to save are fields in the two-tuples returned by the seites.list_pages() function in your app.
- class seitegeist.backends.AbstractSeitegeistBackend[source]¶
Abstract definition of the interface for a Seitegeist backend. Please subclass this and implement your own.
- class seitegeist.backends.FilelikeBackend[source]¶
FilelikeBackend writes the HTML to the target, which is a file-like object, meaning it has a write(str) method.
Settings required for this backend:
SEITGEIST = { "BACKEND": "seitegeist.backends.FilelikeBackend", "BACKEND_ARGS": {}, }
When using this backend, the seites.list_pages() function in your app should return something like this:
[('http://full.url/path/', StringIO.StringIO())]
Of course it doesn’t have to be a StringIO, but anything that can be written to will work. Maybe you use sys.stdout to test your system, or you write your own class with a write(str) method which writes the rendered HTML to a remote service.
- class seitegeist.backends.DirectoryPathBackend(path)[source]¶
DirectoryPathBackend writes the HTML to a target file, provided by a path string.
Settings required for this backend:
SEITGEIST = { "BACKEND": "seitegeist.backends.DirectoryPathBackend", "BACKEND_ARGS": {"path": "/path/to/prerendered/files"} }
When using this backend, the seites.list_pages() function in your app should return something like this:
[('http://full.url/a/path/', 'a/path')]
This will render the HTML from the URL and write it to the provided path below the base path, in this case /path/to/prerendered/files/a/path.
- class seitegeist.backends.S3Backend(access_key_id, secret_access_key, bucket)[source]¶
S3Backend writes the HTML to a target key path in an Amazon S3 bucket.
Settings required for this backend:
SEITGEIST = { "BACKEND": "seitegeist.backends.S3Backend", "BACKEND_ARGS": { "access_key_id": "AMZID", "secret_access_key": "THISISSECRET", "bucket": "name-of-bucket", }, }
The access_key_id arg should be your AWS_ACCESS_KEY_ID, and the secret_access_key be the AWS_SECRET_ACCESS_KEY, and the bucket is the name of the S3 bucket to upload to.
When using this backend, the seites.list_pages() function in your app should return something like this:
[('http://full.url/a/path/', '/a/path')]
This will write the HTML from the URL to your S3 bucket as https://s3.amazonaws.com/name-of-bucket/a/path.
The path will be the name of a key in your bucket. There is no provision at this time to prefix the key.