Back to web development again, but with a different twist this time.  Instead of scraping things, we’re learning Flask, to produce little Python based Websites.  In doing these exercises, I find I am kind of wondering why one would use Python over say, Apache, or NGINX or even IIS.  I can sort of see where it’s useful, and maybe later we will get to more of it’s usefulness.  My primary issue is that the HTML code part of it ends up being VERY specifically Flask based.  Like flask looks for images and CSS in specific folders.  Plus if you use any sort of variables, they all get passed to the HTML in a very particular way.

I had considered that it might be useful for sharing some of the code I have written through my web server, but in my research, things like Tkinter and Turtle don’t work at all through Flask.  I was kind of hoping it was smart enough to produce little Browser pop ups or something to render the graphics out.

This section isn’t super complex so far, but it wraps up the Intermediate+ section with a little interlude for Bootstrap in between, so I figure it’s a good little chunk to keep in it’s own write up.

As usual, the code is all on Github.

Day 54 – Intro to Flask

There was literally no project today really.  We created a basic “Hello World” Flask server, then created some Decorator Functions.  It was interesting, but not really that exciting to write up.  I do somewhat question the usefulness of a Decorator a bit, versus just having a function that takes an input and modifies it directly.

## Day 55 – Higher Lower Game Returns

The Day 55 Lessons were a bit better.  We covered Decorators a bit more and how to handle URLs in Flask, which brings me back to the “Is this better” I mentioned in the opening, since once again, the code will get weird to use outside of Flask.

I had a lot of fun with the project though.  It’s a web version of the “Higher-Lower” Game from way back on Day 14.  You Pick a number, it tells you if it’s higher or lower, only with web pages.  It was essentially a way to learn about using Dynamic URLs in Flask, but spiced up for fun.  I added a nav bar to mine so the user didn’t have to type a URL and could just click the next number to guess.  I also used a bunch of silly GIFs from my favorite musicians instead of Cat GIFs on each page.  

It’s kind of useless, but it was fun to build.

Day 56 – Personal Website

This day was mostly about how to quickly import existing code to Flask.  It involved a couple of practice projects and a “real” project.  The first Practice was taking the Lesson 41-44 website and importing it to Flask.

The second practice was to use someone else’s template and import it to Flask, as well as modifying and simplifying that code.

The final project was to build a simple “Name Card” website with some social links.  Essentially, it was a repeat of the second practice, but actually replacing images and information.  I kind of prefer the previously made CV website and it’s easier to hose on the web so I’m going to stick with that for now.

Day 57 – Blog Capstone Project Part 1

This project picks up in Day 59 with the start of the Advanced Section of the course.  The basic idea here was to build a simple blog interface that would read some generic JSON Posts and display them, and then let users click into each blog post to read more.

I’m particularly proud of my result, which only uses one HTML file, that varies if the user clicked on a blog post or not.  I feel like it was a pretty slick solution.  The starter files also included a file to make a “Post class”.  Using this class was not part of the assignment, but I suspect it will come up later, so I went ahead and built it, though I didn’t use it to read the blog posts.

If this comes out alright, I may actually use it somewhere, I’ve been looking for something to put on Joshmiller.net.  Though I also don’t really NEED another Blog outlet.  I barely maintain the one I regularly use now.