Journey Through Django–Off the Starting Block!

Made some good progress this week. Got a good understanding of Django’s structure and how everything connects. While the tutorial glazed-over a number of aspects of developing in Django, it gave me enough to go off of, so that I can find “how to do {specific task} in Django” if need be.

After some research, and talking with some non-technical friends about it, I’m starting to doubt the complexity I created in my head. First off, I can completely eliminate the process of entering all appliances to get their rated power consumption, that would be accomplished by reading the electricity bill. I have a propensity to go way too granular on things, and bouncing ideas off others definitely helps squelch that.

So this app will only require the use of two API’s: one to grab the latitude-longitude using a postal code, and one to use that to find the solar energy. For the locating part (called reverse geocoding), I didn’t want to use Google services. People have varying thoughts & attitudes on their handling of our data, so I went with Positionstack. There are other geocoding API’s, but I like their clean & simple output, should make this part of the app pretty straight-forward. I’m also only limiting the user’s input to their postal code, as the latitude-longitude returned doesn’t change significantly if I use the exact physical address.

As for getting solar energy data, I went with the Nat’l Renewable Energy Laboratory’s solar API. To say their public API’s are “thorough” would be vast understatement. They definitely spent a lot of money just on the documentation, which I can’t really say for the other solar-related API’s I found. I will definitely need to do more research to find which of their photovoltaic data points would be most appropriate.

I am definitely using test-driven development for this project. I used it in a couple of my projects while at Flatiron School, and really enjoy that workflow. Robert Martin (aka “Uncle Bob”) has a lot of great content on this topic, here is an intro video about it. For me, the process of writing the tests first helps break-down the application’s expected behavior from a user’s perspective and to think of potential edge cases. A user entering “%*#$@” for a postal code would be an example of an edge case. Most people would normally not do that, but it is something we have to account for. Once the tests are done, I just write the minimum amount of code necessary to make them pass. I also get a clear indicator if/when I need to refactor or add additional features. I’ve never done test-driven development in Python, so it’s onto another tutorial!

If you want to follow-along, the project can be found here.

This Post Has 7 Comments

  1. Hey there! Ꮤould уoս mind if I share yօur blog ԝith mmy facebook
    group? Thегe’s a lot ᧐f people thɑt I think ᴡould гeally
    enjoy yoᥙr ⅽontent. Plеase let me know. Thank you

    1. kerneltux

      Thank you for checking it out, and yes, by all means share! 😀

  2. gems generator

    Tһanks ffor ones marvelous posting! І certainlу enjoyed reading it, you hapρen too
    ƅe a great author.I will remember to bookmark your
    blog andd mаy comе bzck very sоon. I want tо
    encourage you t᧐ continue your grеat job, have ɑ nice morning!

    1. kerneltux

      Thank you! 😀

  3. Tһank yoս for the auspicious writeup. Ιt іn fact was ɑ amusement account it.

    Look advanced to moгe added agreeable from you! Ηowever, һow could ԝe communicate?

    1. kerneltux

      Thank you, I’m glad you found it helpful. 🙂

Leave a Reply