I was looking to implement some website authentication using Flask and recalled that Mozilla had a relatively new framework called Persona that might be interesting. A quick look at the documentation turned up a Python code example and it was straight forward to plug it into a test app.
I used a simple Flask backend and basically just cribbed the code from the Mozilla documentation. It may have taken longer to get the UI working through jQuery to show/hide the text on the correct login/logout actions and to figure out what needed to happen with the session object.
This was another great little one day project. Gave me an excuse to setup iPython and iPDB again and refresh my debugging of Python server code and JS code (in Chrome). There are a lot more of these little one day projects I plan to tackle and then start rolling them together to build something interesting and compelling. I have my sites on an HTML5 web app to do music synchronization and streaming from Dropbox to browsers and devices.
After jumping into the deep end with Django I decided to take a longer look at a lighter-weight web framework. I've looked at web.py and now Flask and have been testing some things out with Flask lately and have been enjoying how quickly things come together.
In particular, It took merely an hour for me to take my very basic index.py implementation with some simple routes defined and convert that to a page that connects to a sqlite database and exposes a REST Api. The extensions Flask-SQLAlchemy and Flask-restless were key to the effort. Both simple to install and use.
I've been experimenting with the Jinja2 templating system that Flask uses by default and have had some success there too. I've even found references online that show how to tweak the Jinja2 syntax to allow using handlebars templates within the Jinja templates.
I'm looking forward to getting a system put together that uses a ton of these readily available helper libraries that make web development so slick. I can see using: Flask, SQLAlchemy, Jinja, Handlebars, backbone.js, underscore.js, less css, jquery (or zepto), and something akin to socket.io.
There will be bitbucket links coming soon with the samples and tests I've been doing, or maybe github.
Lately, I have been digging into Python. I was a (reluctant) convert to Python back in 2006 or so. I disliked the strict formatting and the idea of learning a new language (what's wrong with js?). Now, however, I find myself enjoying it thoroughly and hungry to know more about the language and ready to use if for some major projects.
I'm planning on writing up a longer description of how I'm setting up my system but here are the cliff notes:
I recently installed Ubuntu 12.04.1 with Python 2.7.3 on it by default. I plan to start testing/modifying code for compatibility with Python 3 but will have to use the next item to ease that development headache.
virtualenv, virtualenvwrapper and pythonbrew
Ran into a big problem installing Python 2.7.3 in pythonbrew, did several searches and eventually found this: https://github.com/utahta/pythonbrew/issues/65 - Basically, I just needed a bunch of extra dependencies installed to get all the modules in Python built.
I'm still having a little trouble using pythonbrew in conjunction with virtualenv. I'm considering using pythonbrew to *just* manage downloading, building and installing different versions of Python and using virtualenv stand-alone (not the integrated venv command in pythonbrew) to create the sandboxes so I have a little better control. [ed: just gave the separated approach a try and it seems to work great]
Eclipse + pydev ~= Aptana
I'm new to the Eclipse IDE although it's been around for awhile. Using it is the first time I've had Python debugging available to me and it's awesome. I can't wait to get it fired up with django or flask and see what it can do.
I'm pretty much a convert these days, although I still feel a little lost in the system. I'm getting a bit of a pattern down but forget to pull/rebase daily. I was hoping to just the Egit Eclipse plugin with Aptana but it needed a more recent version of Eclipse. I may try installing Eclipse and the pydev plugin and see if I can get that combo working with Egit. I have both github and bitbucket accounts and have been using bitbucket more lately, might bounce back to github though.
There is more to come as I tighten up my development patterns and add things like django, flask, tastypie and I'm sure lots more to the mix. A dedicated (i.e. non-blogpost page) is probably warranted so that all the details can be laid out in full.
As I'm working on picking up Android development I've been noticing that the docs and books on the subject only scratch the surface of how to do things. The nice thing about the platform, though, is that there seem to be a lot of code samples available for how to get deeper. There is also a strong presence in stackoverflow which helps. Plus I just ran across the main developer page and noticed a bunch of video content that may be interesting (missed it by going straight to the API docs).
For my part I'm working through some sample projects myself and will be posting code to bitbucket and posting thoughts, insights or problems in this space. Looking forward to getting deep in this stack.
At Songbird we have a server set up to receive crash reports from our users. It's the same system Mozilla uses, written largely by Google employees and it's called socorro. It's great having that data and there is a web app that you can run that will display the data, the stack frames, charts and other goodies. You can do some simple searches and see the top crashers over a certain period of time.
There is a lot of data there though, and to make really good use of it you need some automation. So I'm working on setting up some automatic queries to run each night via a crontab that will pull topcrash data and deposit the results in a file somewhere in such a manner that I can create a csv file and create a nifty chart for it.
The first step has been figuring out how to run a postgres query command in a crontab. It's taken some time but I've finally figured it out. I should make a little tutorial section somewhere like I did for extensions but I'm so busy I doubt I'll get to that. So here's a list and some links (I assume an already setup postgres socorro database with an additional user: crashreports_user)
- allow the crashreports_user to log in with a password. I didn't actually create the user, but I believe it was created something like this: http://www.ubuntugeek.com/howto-setup-database-server-with-postgresql-and-pgadmin3.html
- set up the permissions on the postgres server to allow a user to connect that *doesn't* exist as a system account (can't log into the machine): http://solyaris.wordpress.com/2008/08/09/setup-postgres-in-ubuntu/ (I also looked at the comments in the pg_hba.conf and pg_ident.conf files)
- the kicker was to set up my account on the machine with the password for the crashreports_user in a .pgpass file, like so: http://www.postgresql.org/docs/8.1/interactive/libpq-pgpass.html
After those steps I was able to run a psql command from the command line as the crashreporst_user and not get prompted for the password. Next step is to work on the proper sql query statement to return exactly the data I need.