Flask trial run on PythonAnywhere

I felt it was about time I got into the web development side of Python, having learned enough of it to be dangerous. Since I moved my site to a PaaS, I wanted a quick and dirty alternative Python host that was easy to set up and use. Enter PythonAnywhere. This seemed to fit my immediate needs, as the site provides web-based bash, python and ipython shells for free users. They support both Python 2 and 3, so I went with the latter.

Next up, Flask. Their quickstart tutorial was what I used as a baseline. It seemed easier to start with than heavier alternatives like Django. Although the tutorial covers a minimal blog, I was able to make enough tweaks to it to get what I wanted.

Finally, a purpose. My wife is about a month away from delivering our first baby (oh let it be a girl, please 🙂 ), so I decided to make a simple site where the two of us could enter names that we wanted, for both genders. Each entry is equivalent to a blog post in the Flask tutorial, so the underlying code remained largely the same. It was easy enough to add the rest of the parts I needed. Here then is what it ended up looking like, and here’s a screenshot if I end up taking down the site later:

babynames

PythonAnywhere turned out to be a great experience. The founders were friendly enough to exchange a couple of mails directly, which was a fresh change from the noreply@website.com welcome mails that other sites favour. Getting the site up from my local test setup was a simple matter of ftp’ing a tar file over and extracting it.

Overall it took me less than half a day to get everything up, and another few hours of tweaking to add cute pictures and stuff.

Self-hosted Read-It-Later alternative

I was addicted to Pocket for a few months because of how well it fit into my reading habits. It had an elegant extension that basically allowed you to click-and-forget while all the magic happened in the background. The service filters all the trash from a page (typically a long article curated by the likes of The Browser and Longform) and neatly synchronizes content with other endpoints (my Android tablet and phone in my case). This was great for my evening commute back home because I’d usually have half a dozen or so interesting articles to read in a neat, clean page.

My very addiction to the service is what led me to explore other alternatives. Poche is the one I discovered and eventually settled with. It works just like Pocket as far as the content display goes, the major selling point being its open source nature. The devs have come up with a hosted solution for those who don’t run their own servers. Although saving and displaying work similar to the alternatives, sync does not. Your articles will still be in your poche but the android app will not cache them offline as of now.

poche

I’ve been running their self hosted version for more than a month and it has become a part of my daily routine now. I highly recommend supporting the devs for coming up with a great open source alternative in a niche that was largely proprietary until now.

Got a new VPS

I’ve noticed I’ve been pretty bored these past few months, and the most noticeable culprit has been the VPS that I stopped using some time back. I used to enjoy installing and trying out new web applications and servers. So I decided to get another one. This time I went with an OpenVZ server instead of Xen, and the provider I picked was Iniz, who I came across in this roundup at LowEndBox. The server is pretty neat, with 2GB RAM and 100GB of disk space. I’ve decided to go with CentOS, since I like Fedora/RedHat already.

It’s been a day since it was provisioned, and I feel the old skills returning: securing ssh, configuring iptables, installing postgres, setting up cron jobs, and so on. This blog will (as usual) probably be wiped out or moved to something on the server. Other webservices that I’ve been using (NewsBlur, Pinboard) will also probably move to self hosted equivalents (TTRSS, Shaarli).

Playing with OpenShift

Openshift is a Platform As A Service offering from RedHat, and has been there for a while now. It never really came up in my radar for some reason. Fortunately I took a dive into it last week and have really liked the whole service so far.

I chose the free accounts of course, since I’m the only one who visits my own site and I really don’t need to scale to the point where I’ll need the premium offerings. The free plan comes with three small ‘gears’, which is a container that comes with 512 MB RAM and 1 Gig of space. Into this, one can slot a cartridge.. which is basically a stack for a Programming language like Perl, or a DB like MySQL.

sandbox

I’ve kicked off with just one gear for now: I’ve wanted to try out Perl Dancer and this was just the opportunity I was looking for. There were straightforward instructions in the OpenShift docs, and I had an application deployed and ready in just a few minutes post-signup.

I spent another hour or so figuring out how Dancer did it’s magic, and have made trivial modifications in the router, views and templates to understand things better. I have a PerlBrew setup locally. Together with cpanm, I can install stuff on my laptop that is in sync with what is deployed on OpenShift’s cloud.

Here then is my first foray into web application development. I don’t expect the content or the layout to stay the same for long. Currently I have used Zen::Koans to print a random koan each time a particular page is queried.

Test driving ownCloud

I’ve wanted something like this for some time, so I’m glad I met this beautiful project called ownCloud. It is an open source cloud storage service that has some pretty neat features.

The installation was laughably easy: I just ftp’d and extracted the zip file to my www root and provided a username and password in the install page that came up. That was it. It took me quite a bit longer to get webdav working in my stupid windows pc. Anyway I wasn’t too keen on the synchronization aspect so I didn’t bother with it too much. FTP’ing some music and pictures directly to my account’s data directory was sufficient for my purposes.

This is where the project starts to shine. An in-built media player allows music to be streamed automatically. It even persists when navigating to other sections in the ownCloud page (there’s just a momentary skip between page loads). Similarly, uploaded pictures show up automatically in a gallery. For text files, there’s an in-built text editor that refused to work for me (saving a file ended up in a 0 byte file.. maybe a permission problem?)

That’s not the end of it, so far I can see that it has facilities for bookmarks, calendaring, address books, sharing, and so on. Although it occasionally feels buggy, it does a fine job on the whole.