So, after years of deliberation, I finally decided to take the plunge and start my own blog. Of course, that meant that I had to go through the canonical modern day 'hello world' a.k.a coding a blog engine. Many before have cautioned about heading this path, including my friend "Time Magazine Person of the Year 2006". However, I wanted something extremely simple and use Dropbox to synchronize and backup content. I also wanted a pet project to hack on every now and then.
I've written the blog engine, autopilot, in Python and support Markdown to write content. I can use any text editor on my desktop and the files are automatically synchronized and published on my blog. Heck, if I'm up for it, I can even use my iPhone or iPad to write new content using an app like PlainText
The application itself is a pretty basic tornado webapp consisting of mainly three pages. There is a separate synchronization script, which does the heavy lifting of downloading files from Dropbox and keeping things up to date. And, while I was at it, I even threw in support for Google Drive. Sorry SkyDrive!
- True auto-publishing via Dropbox and Google Drive
- Markdown to quickly write in any text editor
- Lightning fast, in-memory, database-less design
- Extremely small memory and cpu footprint, runs on an EC2 micro instance without breaking a sweat
- MIT-licensed, hosted on Github, and I accept pull requests :-)
Clone the repo
git clone https://github.com/kumarnitin/autopilot.git, or download the latest release
In src/www create two folders
mkdir src/www/_articles src/www/_store. These are the folders where your files from Dropbox/Google Drive will be synchronized.
pip install tornado pyyaml pystache markdown2 dropbox google-api-python-client
Create your own Dropbox API app key by visiting Dropbox
- Click create an app button and fill in the app name and description
- Choose Access level as 'App folder'
- Copy the App Key and App secret to
If you want to use Google Drive, create an app key by visiting Google API Console
- Create a Client ID for web applications.
- Copy the Client ID and Client Secret to settings.conf.
- Now manually, create a folder in your Google Drive where you will save your content. Save this folder name under
google_drive_folder : articlessetting in settings.conf.
settings.confand set the following values:
pass_phrase: set a secret password for your website, it's used with some admin pages
If you want to use Google Analytics, copy and paste code from Google Analytics to
Similarly, to enable Disqus comments, copy the code to
Run the webserver
python app.py --logging=none --port=8888
http://localhost:8888/setup?pass=XXXXand setup either Dropbox or Google Drive. Replace XXXX with the pass phrase you set earlier
Setup a cron to run the synchronization script every 1 minute,
python sync.py, to test you can run the script in a loop from CLI by passing a frequency parameter, example to sync every 10 seconds
python sync.py --f=10
To publish a blog using autopilot, simply create a new Markdown file *.md in your Dropbox or Google Drive folder.
There are a few simple rules to keep in mind
- autopilot treats the first line of the file as your blog title.
- An article is treated as published if a bracketed [date] is found at the start of the first line.
- To keep the article as draft, don't include the date until you are ready to publish.
- To proofread drafts before publishing, visit
http://localhost:8888/draft?pass=XXXX. Replace XXXX with the pass phrase you set earlier.
So far I'm thrilled with the convenience this brings and hopefully it encourages me to write often, until then happy hacking!