Welcome to tinyblog’s documentation!

tinyblog is a Django app for single-author blogging. It has three key features:

  1. Delayed publication: Set a date and time when you want your blog entry to be published.
  2. Email lists: Allow users to subscribe to email updates, tinyblog will handle confirmation of email addresses, and will always include unsubscribe links in any emails it sends.
  3. Syndication: tinyblog allows you to have the same content on multiple sites, by exposing a JSON feed of posts, and allowing you to import from that JSON feed from other sites.

Contents

Installing tinyblog

tinyblog supports Python 2.7, and Django 1.4, 1.5, 1.6 and 1.7. Python 3 support is blocked waiting for django-uuidfield to support Python 3.

tinyblog is available on PyPI, so can be installed into a virtualenv with pip like this:

pip install tinyblog

Once you’ve installed tinyblog, just add it to your INSTALLED_APPS, and set up your urls.py to reference it:

urlpatterns = patterns(
    '',
    ...
    url(r'^blog/', include('tinyblog.urls')),
)

To integrate tinyblog with your site’s templates, override tinyblog/base.html. tinyblog expects the main content block to be called contents.

Management Commands

mail_subscribers

mail_subscribers sends the oldest unsent, published blog entry to all current e-mail subscribers (subscribers will need to have confirmed their subscription using the link in the email they received when they signed up, and must not have unsubscribed).

mail_subscribers will only send one email to each subscriber when it is called - if multiple entries are due to be emailed, you’ll need to run it once per entry.

You probably want to set up a cron job to run this management command regularly - set your frequency depending on how close to the publication time you set when creating the blog entry you wish to send the emails.

import_tinyblog

One of the URLs exposed by tinyblog is at json/, which gives a JSON dump of all published entries. You can import entries from another blog (provided the other blog is built with tinyblog) by running:

django-admin.py import_tinyblog http://www.example.com/blog/json/

Duplicate entries won’t be created (an entry is deemed a duplicate if it has the same slug as an entry in the blog being imported to), so it’s safe to run this command repeatedly on the same target URL (for example, using a cron job).

Settings

TINYBLOG_FROM_EMAIL (required)

Used to set the “From:” field when sending emails.

TINYBLOG_TITLE (required)

Used in the RSS feed to provide the feed title.

TINYBLOG_AUTHORNAME (required)

Used in the RSS feed for the author name and the copyright notice.

TINYBLOG_DESCRIPTION (required)

Used in the RSS feed to provide the feed description.

TINYBLOG_DISQUS_SHORTNAME

Should be set to the Disqus shortname for the site, if any. Without this setting blogs will not use the Disqus integration, so comments on blog posts will not be supported.

TINYBLOG_SITE_NAME

If django.contrib.sites is not in INSTALLED_APPS, this setting is required, and is used in emails sent by tinyblog.

TINYBLOG_SITE_DOMAIN

If django.contrib.sites is not in INSTALLED_APPS, this setting is required, and is used in emails sent by tinyblog as a link prefix.

TINYBLOG_ALLOWED_TAGS

Set to a list of tags to allow in posts. Defaults to:

TINYBLOG_ALLOWED_TAGS = [
    'a',
    'abbr',
    'acronym',
    'b',
    'blockquote',
    'code',
    'em',
    'i',
    'li',
    'ol',
    'p',
    'strong',
    'ul',
]

This is essentially the default list from bleach, with p added.

TINYBLOG_ALLOWED_ATTRIBUTES

Allows configuring which HTML attributes are allowed in posts. Defaults to:

TINYBLOG_ALLOWED_ATTRIBUTES = {
    'a': ['href', 'title'],
    'abbr': ['title'],
    'acronym': ['title'],
}

TINYBLOG_NO_BLEACH

Set to True to turn off bleaching content altogether. Defaults to False. If this is set, TINYBLOG_ALLOWED_TAGS and TINYBLOG_ALLOWED_ATTRIBUTES have no effect.

Release Notes

0.next (planned)

  • Figure out how to include all the Disqus JavaScript if TINYBLOG_DISQUS_SHORTNAME is set.
  • Improve pagination.
  • Add support for images.

0.5.2

  • Fix a server error caused when you directly access the view for thanking new subscribers.

0.5.1

  • Ensure the invitation form for inviting subscribers submits to a different endpoint to the regular subscription view.

0.5.0

  • Drop support for Django 1.4, 1.5 and 1.6.
  • Add a new view for inviting people to subscribe to the blog - this sends out a slightly differently worded message, to avoid confusion.
  • Switch the last function-based view over to class-based views.

0.4.5

  • Fix for people subscribing multiple times - let’s ensure people only get a single email, and that unsubscribing works.
  • Print out each email address that had emails sent when running mail_subscribers.

0.4.4

  • Allow searching on email address in the admin.

0.4.3

  • Ensure Disqus works over HTTPS, by using protocol-relative URLs.

0.4.2

  • Add Django 1.8 support.

0.4.1

  • Fix a bug in the unsubscribe page with the link for going back to the blog (the url tag was split over two lines, so the link didn’t render correctly).

0.4.0

  • Help prevent inadvertent unsubscriptions from link pre-fetchers/forwarded emails by requiring an email address be entered to complete cancellation of a subscription.
  • Remove the need for UUIDs in the unsubscription code (this will break old unsubscribe links).

0.3.0

  • Drop Python 2.6 support (it may still work, but is no longer supported).
  • Switch test format to py.test.
  • Add support for Django 1.6 and Django 1.7.
  • RSS feeds now contain bleached post content (with this release, all places where HTML is output are now passed through bleach).
  • Add tests to ensure generated RSS is valid with bad HTML, using feedparser.
  • Removed South migrations - they aren’t currently used (we only have an initial version), and this will smooth the way to switching to using Django 1.7’s new migrations feature.

0.2.0

  • Add settings for allowed tags (TINYBLOG_ALLOWED_TAGS) and allowed attributes (TINYBLOG_ALLOWED_ATTRIBUTES) in bleach.
  • Added a setting for not bleaching content at all (TINYBLOG_NO_BLEACH).
  • Default to allowing the p tag through.

0.1.9

If you’re using South, and have an existing installation of 0.1.8 you’ll need to run after installing, otherwise future migrations will fail:

python manage.py migrate tinyblog --fake
  • Added initial documentation.
  • Set up Travis CI integration for continuous integration testing.
  • Removed dependence on sites framework by introducing two settings TINYBLOG_SITE_NAME and TINYBLOG_SITE_DOMAIN. These settings are only required if you do not have django.contrib.sites in your INSTALLED_APPS.
  • Re-added South migrations (removed before first publicly released version).
  • Added support for bleach (if you have overriden tinyblog templates, you may wish to access bleached_teaser, bleached_text and bleached_full_text, rather than teaser_html, text_html and full_text respectively). Text is stored as input (i.e. with any bad tags or attributes), and cleaned on output.

0.1.8

  • First version with fairly comprehensive tests.