21 October 2014

Hackbright Day 16: Sessions + More Flask

When I transferred high schools way back in 2001, I joined all the extra curricular activities that I could in order to meet people and make friends. Some of them turned out to be life-changing (Hi, Ms. Maciolek!) and some of them turned out to be a huge waste of time (that would be you, softball). One of the things that sort of fell in between those extremes was the literary journal *thing* that I did one year. One of the first orders of business was to pick a name for it. My suggestion was "Sessions". They ended up going with "Harbinger". Speaking to the incredible content of my character, I basically lost interest once my name wasn't chosen.

Fast forward 13 years, and now I finally get to talk about sessions.

Sessions, in this context, are about storing information on the server side of a web app. In Flask, the session is a dictionary that you fill with information like, for instance, the user name. For websites where you might buy something, everything you'd add to a shopping cart would be in the session dictionary.

Our assignment today was to make a webapp. The skeleton for the app was already in place, but we needed to add things to it to make it functional. We ended up using Flask, the python framework for web apps, SQL, html + css, and jinja (which is a way to inject a little bit of python into the html). It was a lot of fun, actually, and we were able to make a functional app with a log in page and an account page.

I had a meeting with my advisor today and at his suggestion, I'm going to try to work on a project on my own to create an app, mostly to practice all these new skills that we've been talking about in class.

apt-get install ROBOJULIACHILD 
So my intent is to create a recipe-generating bot that is based on a few different recipe "structures" and will then randomly select things that would go with it. I've sort of sketched out an idea of how to implement it. The working name is cook roulette, but robojuliachild is my favorite. My biggest thought is to make the recipe structure a class and then have the different kinds of recipes (e.g., quiche, risotto, etc.). This works because I'm probably not going to make anything that's too fancy, but doing this with classes makes it modular so I could come back to this easily. What's also nice about this is that I can get more experience with classes without having to go back to that horrible game exercise. (I should definitely probably revisit that at some point.) I'm thinking that it would be interesting to add baking recipes to this because you could calculate the required ingredient amounts based on the ph of different ingredients.

We also talked about how the internet works and now I think I want to run my own server to deploy my own apps. And then I brought up cookie clicker because I'm totally a winner like that.

No comments: