Cuttlepress

Blogging about Hacker School?

Day 20b

Somewhat in response to yesterday’s fiasco, but more because I’m enjoying making a habit of doing my Friday work in Python, I decided to work on today’s optional-jobs-prep “make a bit.ly clone” assignment with Flask. Progress was slow and very frustrating at first, even with Amy’s help at installing various dependencies, but Alan saved the day by getting me up to speed with the basics: learning about how both browsers and curl handle/send GET and POST requests, how to access form information from Flask, Jinja templating, and a brush-up on HTML forms. The URL-shortening is boring and poorly-implemented (I’m not obfuscating the links or anything, nor am I providing for multiple instances of the same or even similar links); the successes are that it’s a working web app with input, output, and persistent state. I even managed to get it up on Heroku, after a bit of a struggle with two unrelated bugs. One was that I had failed to install gunicorn in my virtualenv and thus didn’t have it in my requirements.text, and the other was that I was misunderstanding the proper use of Flask’s “url-to” function. I wish the Heroku error message had been a bit clearer about how exactly to “check your logs,” which was simple in retrospect but nonobvious at the time; it took me a while to even realize it was a thing I could google for. Here’s the bare-bones thing; hopefully improvements will occur in the future. (Particularly improvements involving appearance! I’m sick of not having pretty pictures to post. Time for some Sass, I think.)