Flask. Draft. And Awesome

Okay, so things are coming together. Using the insanely awesome guide to Open Sourcing a Python Project the Right Way, and the inestimable @audreyr's cookiecutter package, I have developed a super simple Flask app that does one thing: Allows you to use Draft to write your blog posts. It's on GitHub and PyPi. It's the first package I've published to the Cheeseshop, and I wouldn't have done it without the awesome tools these folks provided. So if you want to use Draft to write (and keep versioned) your Pelican posts, now you have a tool to make publishing that much easier. Assuming you already have Pelican set up, here's what you do (you are using virtualenv/venv, right?):

$ pip install draftin_a_flask
$ env DIF_PELICAN=/path/to/pelican \
  DIF_CONTENT=/path/to/content/files \
  DIF_OUTPUT=/path/to/output \
  DIF_PELICANCONF=/path/to/pelicanconf.py \
  draftican

Alternatively you can put a .draftican file with a JSON string version of the settings (e.g. `{"CONTENT": "/path/to/content/files"}')

Your server will start listening on port 5678, with a randomly generated endpoint for a bit more security. Copy that endpoint and setup your WebHook to point there.

And now you should be able to create posts using Draft and publish them in one or two clicks.

A couple of features I plan to add down the road: - automagic SSH/rsync deploy - the ability to commit to git/hg (for ease of rebuilding your whole blog from scratch)

If you find this tool to be useful, I'm on gittip. Or if you've got some Dogecoin and you're a generous shibe, send much love, wow, very here: DKhupfyX839HcgqBKz7CU6EQ8vg81PeQLV

Or ping me on Twitter or Google+

links

social