Ryan's Chipy Blog

From Hatchling to Slightly Experienced Hatchling The Trilogy, Part 2

Hello World.. Again!

Long time no blog!

Time flies when you're having fun, and these past few weeks have been pretty great on my Python adventures. Semi-related, but time also flies when you spend a lot of it at your job ;).

Kudos

Since this blog is a public ledger I feel that it would be appropriate to call out a few people that have really helped me out and enabled me to invest my time learning about Python and Django.

Evan

First, no Chipy Blog (tm) would be complete without at least a few sentences about someone that I think would be fair to say is the world's best Python mentor in the Chipy Fall 2017 group, Evan Hahn. With his help I now have a tight dev environment on my server, a slowly but surely impoving sense of development in general, and confidence that I can actually write functional software. When we have a meetup, I don't just get some guidance on what to or the a casual "that's not how you spell resopse", Evan takes the time to really illustrate concepts and practical implimentations of what we're doing and why things matter.

Ray and all my Python Pals

Some time ago some enterprising folks at my job started a Python enthusiast club where on Monday evenings we take some time to just sit down and either tackle some code challenges, or work out a problem that one of us is taking on and could use some help. Even though it's just a few short hours a week, it's a real priviledge to be able to work on my coding skills in such an awesome environment. Think group challenge night but more Ray and less introverted anxiety. Also Ray is just generally amazing. I'd go on but then this late blog would never get finished!

Callie Clay and James Beesley

In my final act of overt gushing, I'd like to call out how incredible these two people have been for me. First and foremost the love of my life Callie has been unreasonably supportive. Whether its been making me a cup of coffee before I fall asleep on my laptop or just picking up our pup from doggy daycare so I can stay late at work, she has really been the wind beneath my wings.

I'd also be remissed if I didn't give a quick shout out to my manager James B the third. Telling me to home early after my forth day in a row working late and letting a programming lunch session slip a touch longer than it's supposed to have been super helpful and appreciated.

Trello, Vim, and the URL

Part of my Hatchling journey has been more than learning the ins and outs of Python. In our session we decided that it would be useful to set up a Trello board and it's a really nice way of keeping myself grounded. As I continue to dream up new features inbetween coding sessions trying to implement much more modest ones, I can really get a sense of what I need to do and where I'm going with this project.

Vim. This is easily the best and worst thing I've ever started using while learning to code. The shortcuts are spectacular and really help you quickly zip around what you're writing and I've witnessed firsthand how insanely efficient having built-in regular expression hotkeys are but man oh man the learning curve is quite steep and I'm going to boldly come out and say some of this stuff is less than intuitive from the outside. That said, having seen the benefits when used by a pro I can safely say the pain pays off when it finally pays off

Oh, and in the event my intermittent lenghly ramblings weren't enough for you people to see what I've managed to eek out over these last few weeks (which have really felt much shorter than that) here's a URL you can visit while the server is up:

The Best Soundboard In The Universe Someday

DataBase Planning

After pontificating my hopes and dreams of what a universal soundboard generator would look like, Evan and I came to a conclusion that utilizing a postgres database and utilizing as much of Django's built-in database/model code as we can would be the right move. So it was off the the whiteboard!... Literally!

As the general idea is that you as a user would be able to make many differnent/themed soundboards you would then need a way to upload files to MY server in a way that was both safe/reasonable for me and intuitive for you. Thus we deided on a many to many relationship between the two most important models, the Sounds and Soundboard models. We took a good long look at Django's documentation and here's what we generally concluded the models should look like:

class Sound(models.Model): name = models.CharField(max_length=140) text = models.CharField(max_length=280, null=True) sound_file = models.FileField(upload_to='sounds/') user = models.ForeignKey(User, on_delete=models.CASCADE) image_file = models.FileField(upload_to='sound_images/')

class SoundBoard(models.Model): title = models.CharField(max_length=140) user = models.ForeignKey(User, on_delete=models.CASCADE)

After that was established, I finally got an explanation of what migrations are. Following this, I learned how to manually roll back migrations after adding new non-nullable fields with no defaults set. It's nice doing development work in a development environment with far off deadlines <3.

The next big challenge will be fleshing out all of the views (praise be to BootStrap) and getting a slick login/signup page to actually function. If I can do this in a reasonable timeframe I'll try to put up a new blog post detailing the process. It turns out not many have opted to try to force Django's built-in login handling code to live on the same view the as the built-in signup form. Who knows! I might just become Django famous if I can clearly show how it can all work together!

Untill next time!

Fin