Forums

Generating a static blog using Pelican and hosting on PythonAnywhere/S3

I'd like to create/edit blog posts on an iPad. There's a good Markdown editor called Editorial which supports custom actions, and it's possible to write these actions in Python. In editorial, documents can either be created locally or on Dropbox. I understand that support for Dropbox is being phased out of PA, so this feature is less relevant.

However, I could create a 'publish blog post' action which would do the following:

  • Send the Markdown document to PythonAnywhere. Perhaps I could use the Paramiko module to create a new file in a specific directory and then write the Markdown content to it.

  • Once the new blog post has been copied, run the pelican static site generator to build the new site.

  • Use s3cmd to transfer the generated site from PA to Amazon S3, or simply host the site on PA itself.

If this seems possible, or anyone can think of any alternatives, please let me know. Cheers!

Why not build a simple web app, hosted on PythonAnywhere, to receive and process the markdown from Editorial?

It could take a POST request including a filename and the markdown content, and then save the markdown to disk. Then, you could make it run a pelican build to generate the new html for your static site.

On the same PythonAnywhere web app, you can then set up a static files mapping to serve all the "normal" pages for your blog, as raw html...

Thanks Harry, that sounds like a good plan. I'll have a crack at it and let you know how I get on.

I wrote a tutorial about setting up Pelican on PyhtonAnywhere, you might find this useful: http://www.lesinskis.com/pelican_on_pythonanywhere.html

If you have any questions I'll do my best to answer them here.

Thanks for the link, Janis!