← Back to Show Notes

Transcript: Django vs Flask - Michael Herman

Will Vincent

Hello and welcome to another episode of Django Chat.

In this episode, we're joined by Michael Herman, the founder of Testdriven.io.

I'm Will Vincent, joined as always by Carlton Gibson.

Hi, Carlton.

Carlton Gibson

Hello.

Hello.

Will Vincent

And Michael.

Hi, Michael.

Michael Herman

Hello.

Thanks for having me.

Will Vincent

Yeah, happy you could come on.

So the title of this episode is going to be From Flask to Django because you've spent a number of years writing production level Flask code and recently switched over to Django.

So we're going to spend a lot of time talking about that switch and differences you've seen between the two frameworks.

But first, can you give a quick background on who you are and how you got into programming?

Michael Herman

Sure.

I'm an engineer/slash educator from Denver, Colorado.

And yes, I am the founder of Test-driven I.O.

which I will talk about in probably just a bit.

So my backgrounds, I started web development in the late 90s competing with a friend in Missouri.

We were building PlayStation websites and eventually moved on to the Lamp Stack and got into hardware during high school.

My undergrad years, I spent at uh University of Missouri, started in computer science, moved to philosophy, ended up getting a business degree.

After undergrad, moved to New York, got a job at Yahoo, ended up getting transferred out to San Francisco, quit Yahoo, got a master's degree, started working at startups, got into a lot of Python, web scraping, testing, and that's what led me to co-found RealPython with another friend of mine.

So RealPython is a uh

Will Vincent

What's a Python tutorial site, right?

Or that's what it was initially when you were involved.

Michael Herman

Yeah, so yeah, RealPython, I started as like a Kickstarter basically for teaching uh practical Python, learning by doing, um, experiential type learning Python.

Uh this was back in 2011.

We ended up kickstarting two other courses, a Flask web development course slash web fundamentals course, and then a more advanced uh Django course.

And so, yeah, again, the philosophy behind it was learning by doing, experiential learning.

There was nothing really out there at the time in terms of beginner courses that had that uh experiential uh learning philosophy.

And so um, yeah, we we kickstarted RealPython.

Um, I got into more into tech education that way, taught full stack uh JavaScript for a couple years at a boot camp called Galvanize.

Will Vincent

And that was in Denver.

Michael Herman

Yeah, that was in Denver.

Yep.

Michael Herman

And so after Galvanized, you know, had to deal with a bunch of imposter syndrome.

Can I build anything other than just a basic crud app?

So went back into the industry, focused mostly on uh Flask development, and at the same time started testdriven.io, which uh focuses on teaching mid to senior level developers how to build, test, and deploy microservices to AWS.

Carlton Gibson

Wowza got a big tail.

So what were you using back in the 90s?

You said you started off was that Pearl or PHP or what?

Michael Herman

GeoCities.

Well good.

Yeah, I trumped your PHP.

Michael Herman

Just straight HTML and CSS.

Yeah, yeah, good.

That's it.

A lot of tables.

Yeah, good.

Will Vincent

So maybe so let's talk about um test driven, because that's built with Django, and maybe um what was that process like?

So without you know going too deep dive into Flask, I mean, for if listeners don't know, it's a micro framework with Python.

Um, what kind of struck you uh and you'd used Django before, but I think it'd been a couple years since you'd used it on a large project, is that right?

Michael Herman

Yes.

Will Vincent

How did you how did you choose Django and how did you find that uh transition to be?

Michael Herman

Yeah, so I mean Django it it allowed me to move a lot faster than with Flask.

So I wanted to build a full stack uh web application with server-side templating.

And so with all the pieces there that you get from Django out of the box, I was able to move a lot faster uh with Django over Flask.

Carlton Gibson

Well you said you'd been doing full stack um JavaScript is development as well.

So you've been using presumably uh um some kind of microframework in j the JavaScript world like um express or right, Express?

Michael Herman

Yeah, yeah, Node and Express, yeah.

Will Vincent

So did you give that a thought to to use them, I guess, to get to Carlton's point?

Michael Herman

Well, I did have a transition back to Python uh after Galvanize.

So yeah, I did uh teach full stack JavaScript.

Uh I worked on the dev team there, and that was um a big Rails app and they had some microservices and Node and Express that I worked on.

Uh but after after leaving Galvanize, uh I worked for a company uh that was all Flask, and so I got back into Flask that way.

So really the decision for test driven kind of came down to Flask uh versus Django for me.

Carlton Gibson

Right, because you were in the Python mindset at that time.

Michael Herman

Yeah, yeah.

Will Vincent

Okay.

So when you started with Django, do you recall had things changed since you'd last used Django?

Because it'd been a number of years.

Did you have a sense that there'd been a bunch of changes like migrations and stuff, or had you used those before you switched over to JavaScript and Flask?

Michael Herman

Yeah, not much had had changed actually.

Yeah, South, um, the old migration system, you know, was now uh into the core in the core, uh, which is nice.

But I was already familiar with how the ORM worked and the data models and whatnot, so there wasn't that too many changes.

And I think that's really nice with Django.

It's it moves a little bit slower than I would say um some other uh Python frameworks, but because of that, it's it's it's it's much more stable.

Carlton Gibson

Well, like the the core ORM operations have been unchanged forever, right?

So you know if you if you know how to build a model and you know how to filter and you know how to do those core operations, that's the same from from you know day one and to now.

And so and there's all this other stuff that you didn't know about, not that you didn't know about, but let's say, oh, there's annotations now, oh there's search now.

And when did that appear?

Will Vincent

So given your background in teaching, now that you're in fully in the Python world, when if someone comes to you and says they want to learn web development, but they haven't worked with a framework before, how do you think about that choice of Flask versus Django, which often comes up for that for that beginner?

Michael Herman

Yeah, it's it sort of depends on the end goal.

Uh I mean if I would say you know, regardless, uh in general, regardless of whether someone's wanting to learn Flask or Django, I generally start uh or I recommend that they start with Flask.

Uh it's a Flask is just a great tool for learning web development fundamentals in general, like HTTP, routing, uh, that sort of thing.

And those things are common uh you know across all uh web frameworks.

So I think also um one thing that I often overlook is that the source code for Flask is much smaller.

Uh it's much easier to read.

And so diving into the source code of Flask is is really nice.

You can see what's going on behind uh underneath the hood.

Will Vincent

Yeah.

What and what about um for APIs?

Are you using an API with test driven um or or not at this stage?

Michael Herman

I have a couple endpoints, yeah, but I wouldn't call it an I wouldn't call it an API.

Will Vincent

Have you done uh I just I because I wanted to ask, you know, Flask, especially for you know what how do you build an API endpoint?

Flask can do that in a couple lines of code, yet Django Rest framework is uh very elegant.

I just wondered if you had a chance to play around with DRF um recently versus doing it kind of raw with with Flask.

Michael Herman

I have looked at uh DRF.

Uh so one of the uh courses on the uh test-driven site is a um a Django course that deals with uh Django channels, um sold asynchronous um fun and um uh Angular on the uh client side.

So uh I did kind of dive deep into DRF to really understand what was going on there, especially with the um authentication.

Will Vincent

So are are you for local development, are you using um Docker these days with test driven?

Yes, yeah.

And how do you find that?

Will Vincent

Had you because I think you'd been using that at work beforehand, or even um you've been using Kubernetes, is that correct?

Michael Herman

Yeah, yeah.

So yeah, Docker, you know, it just simplifies the development process.

Uh yeah, there there's definitely you know hurdles in the uh configuration and 12 factor with settings and whatnot, .m files versus hard coding environment variables in the uh Docker Compose file.

But you know, once you sort of figure out how Docker is working and figure out how that you want to get those environment variables inside of your container, then it just makes the process a whole lot easier.

Will Vincent

Yeah.

And are you um what what are you doing for deployment?

You've used a host of services that we've talked about offline before.

Michael Herman

Yeah, I'm using Heroku.

So it feels like 2014.

Will Vincent

And uh and are you uh deploying with with uh containers on Heroku or you're just doing it like pro C file way?

Michael Herman

Uh so yeah, right now I'm just using Git and the uh slug compiler.

So I am in the process of moving everything over to the um Docker deployments, but right now I'm just um sticking with the uh slug compiler.

Will Vincent

And then and then so why did you make that choice?

Because clearly you know how to set up a server and do it, you know, on a VPS if you wanted to.

What how did you think about that choice of using Heroku or, you know, a platform as a service as opposed to infrastructure as a service, given that you have experience with both?

Michael Herman

Well, Heroku gives you everything out of the box.

It gives you logging and monitor monitoring.

Yeah, you can set up uh cron-like jobs, uh, all these different services that I would have to set up and manage and up up uh grade and maintain on my own.

Heroku just all does that all for me.

So I can just pass it uh Django and Green Unicorn or whatever, and then set up all those different extensions and you know I'm good to go.

Carlton Gibson

Yeah, that's gotta be that's the saving, right?

That the you know it's all very well maintaining, I don't know, your Chrome file, your cron tab file, but like that's not the most fun in the world.

Michael Herman

No.

Carlton Gibson

And it doesn't take long per se, but there's what that job, and then there's the other job, and then there's the other job, and then there's the other job, and all those add up to more than your heroical build.

Will Vincent

So how did you what was the process for you know prototyping and then building, and and I know you're still working on test-driven.

Can you talk about how you sort of prioritize features and you know, again, uh I think this is a trap sometimes when you go from working in a production environment, you it's easy to want to over optimize everything because you're just familiar with it.

But um there still needs to be some sort of process to getting to this optimized point across the board, and maybe we can talk about some of the optimizations on a Django site.

But do you recall kind of what was the kind of the MVP and then how you layered on complexity?

Um, because I think you you initially had what, a Jekyll site before, so you weren't starting from scratch with the test-driven domain, right?

You already you knew you were gonna have traffic.

Michael Herman

Sure.

So yeah, I did start with a uh a Jekyll site, just a you know, static site generator, and was selling uh the course as just a PDF.

And I wanted to move to uh more of like an interactive you know web application where the end users instead of downloading a PDF and then you know never coming back again, always have to come to the website and log in and and and go through the website.

It's it's more interactive for them, and it's also uh you know, customers will continue to come back and I can upsell them and whatnot.

So yeah, I basically wanted to port over the main functionality from uh Jekyll and then from there needed to add on you know authentication author authorization and then some sort of payment provider to um you know handle payments.

Will Vincent

And then what are you using for the uh payment provider?

Michael Herman

So I'm using Stripe for that.

Will Vincent

And had you thought about because I get these days what it's Braintree as well.

I think and Stripe are the two.

Was there another one you considered at all, or was just Stripe the the one you thought you'd go with?

Michael Herman

Yeah, so you know, there's Stripe, there's Braintree.

There's a whole there's a number of different startups that have been built um on top of Stripe.

Right.

So I was thinking of you know sort of abstracting that out.

So I did initially start with one of those, Gumroad, and uh that was I was using that when I was just selling the PDF, but now that I'm not selling a digital download anymore, I moved away from uh Gumroad.

Will Vincent

Got it.

And then for um for email, because you must have uh both transaction and potentially marketing emails.

Did you set up a sort of any uh async process for that?

Or maybe you could talk through how you set how you set that up in a Django context.

Michael Herman

Yeah, so I do have you know transactional emails for um password or uh email confirmation, then also um you know for other other sorts of things.

So yeah, I'm using uh Django RQ, the extension uh for uh Redis Q.

And so to get the uh process out of the uh request uh response handler, just you know, puts the job into the queue and then have a separate process constantly looking at the queue.

Is there a job?

Is there a job?

Michael Herman

If there's a job, it grabs the job and then sends it to um Sendgrid, and then Syngrid will send out the uh transactional email.

Will Vincent

Got it.

Carlton, I've dominated the discussion.

Are there any questions that come to mind for you?

Carlton Gibson

Yeah, just on the queue choice.

I mean, like um so the big beast in the room is celery, right?

Um and uh I'm just wondering w why you chose RQ over celery.

I mean, you know, I've got my own views there, but it'd be interesting to see what you've got to say.

Michael Herman

I've used RQ um pretty extensively the the past like three or four years, and I was just familiar with it.

I haven't touched celery in a little while.

Uh I didn't really need all of like the robust like um scheduling and retrying that I know that you get from Celery.

Uh so it was just sent basically sending transactional emails.

I have a couple of other things that I'm using the queue for, but yeah, I mean just from a functionality standpoint, I didn't need everything that Celery gave me.

Yeah, exactly.

Carlton Gibson

Okay, Bernie.

Will Vincent

And what about um again?

Because I think this is a great chance for listeners to go through the list of you know, building out from scratch a Django site, you know, with the knowledge that you have.

Was there, you know, testing?

So how did you find, I guess, doing tests with Django, um, because it had been a little while, and then are you using any additional services as well to test your application?

Michael Herman

Yeah, the testing pyramid has really changed for me uh the past few years.

So testing pyramid, you know, most of your tests are going to be unit tests, and you have some uh functional tests, and then at the very top of the pyramid, you do a bit of end-to-end or browser-based testing.

So a testing tool uh came out a few years ago, years ago called Cyprus, and uh that's for browser-based testing.

So it's really actually good for testing out um you know asynchronous uh type single-page applications.

So I would say Selenium is great for server-side templating type applications and page refreshes.

It doesn't handle all the asynchronous uh type stuff really well.

Cypress handles that really well.

So uh what you get out of the box with Cypress is is uh basically uh in-the-end tests or browser-based tests that are a whole lot less finicky and a lot easier to write.

And so because of that, the testing pyramid is for me, I write mostly browser-based tests and unit tests.

Um I kind of steer clear of like a lot of the functional tests at this point.

Carlton Gibson

Interesting.

So what would you call a functional test in that context then?

Because you know, obviously like running a browser automation, that's obvious.

And then unit tests, you're probably you know, testing individual bits of logic.

Then how would you what would you call a functional test and how would you run that?

Michael Herman

Yeah, I guess a functional test that in uh I'm probably what I'm meaning more is like integration tests.

Okay.

Michael Herman

So like just if you have to hit a database or you know, you have to test like multiple functions or you know, multiple views or or whatnot.

Carlton Gibson

Various components working together.

Will Vincent

Yeah.

So related to testing, uh I assume you're using uh some form of continuous integration as well?

Michael Herman

Yeah, so I'm using uh semaphore CI for that.

Will Vincent

And then why did you choose choose them?

I guess.

Carlton Gibson

Is that a host is that a hosted service?

Michael Herman

Is that yeah, yeah, it's a host assumption, yeah.

Will Vincent

Because there's what these days there's there's semaphore, there's Travis, there's Circle.

Um I think GitHub has their own one in beta, maybe GitLab has their own.

What was it about semaphore that um stood out to you?

Michael Herman

I I'm not sure.

I don't remember.

Other than you have to pick one and you know.

Will Vincent

But are you using it just for deployment?

You're using it for um deployment as well, right?

Not just Can you talk about just the pipeline of incorporating it, I guess, in the project?

Michael Herman

Yeah, so yeah, I am using it for both CI and CD.

So continuous uh integration, continuous um delivery slash deployment.

Uh yeah, I guess in terms of the reason why I picked that is the way that I'm running my Cypress tests in pr in the CI environment.

So I'm not running the Cypress test inside the Docker container.

I'm running the Cypress test outside the Docker container, and they are testing against the Docker container and for or the web application that's running inside the Docker container.

So for whatever reason, I couldn't get that to work exactly right on Travis Circle, um, and I could get it to work on Semaphore.

Uh I have been meaning to maybe switch over to GitLab just because I I like uh having the um the source code and CI C D and whatnot built into GitLab, and GitLab has um faults for secrets as well.

So I like that you know, one-stop, you know, shop type platform.

So eventually I'll probably move over to some or move over to GitLab, but for right now, Semaphore is just working uh for me, and uh so there's not really a reason to switch.

Carlton Gibson

No, and once you've got one of these things going, it's really easy just to keep it going, right?

Michael Herman

Sure, yeah.

Will Vincent

Yeah, and then are you doing um uh so local production?

Are you using a a staging server as well?

Michael Herman

Yeah, I do have a staging environment, yeah.

Will Vincent

And then um just for maybe and since you're a former educator, for listeners who aren't familiar with that flow, could you talk about why why you would set up a staging server and how that how that flow plays out?

So you do a local change and then you you know then what happens before it gets to the live site?

Michael Herman

Sure.

So yeah, I do a form of like the uh feature uh branch workflow, um sort of like a Git flow uh type approach.

And so you know I create a new feature branch, uh I make some changes locally, I test it out locally, I you know, do a commit, push it up to a GitHub, that'll uh trigger Semaphore, Semaphore then you know run CI.

Um and if it's on uh for if if uh if it's running against just a feature branch, uh it won't actually do any sort of deployments to uh staging or prod.

But uh as soon as I do a merge request um another

Will Vincent

merge to master

Michael Herman

uh uh merge to develop another uh build will kick off and then as soon as I merge that into develop that's when another build will kick off and as long as that passes then it'll deploy to the staging environment.

So the reason why I do that is because I just want a place to be able to test it out on uh Heroku and just to make sure that um what's happening on my development environment locally is the same as um or is as close to what it will be when it's in production.

Will Vincent

Right.

And then uh so then do you manually go and check before um committing uh to production from staging or how do you make that leap?

Michael Herman

I'll do some like manual tests.

I mean everything's really covered by Cypress at that point so I don't really need to worry about it too much.

But I'll just do like one last visual check or you know if it's a blog post or something like that I'll have I'll send the link to um the blog post author and you know they can take a look at it before it goes live.

So just little things like that.

I like to be able to view it before it goes live.

Will Vincent

Right.

And so are you um as you mentioned authors uh so test driven's what started with just you right but now what's what's kind of the master plan right because I I know you have another course um on there and are you are you you're adding blog posts by other contributors as well

Michael Herman

yeah so uh test driven is you know starting to scale I am starting to bring on more content creators so whether that's tutorial uh authors or uh course producers so the other course on there right now is written by um a friend of mine

Jason Parent he is uh writing another uh course right now um it's basically the the current um Django channels course with uh React instead of Angular um I'm breaking up the uh large monolithic uh course the microservices course my uh myself right now so that's gonna be like four or five different courses hopefully by the end of the summer um onboarding a couple other course producers um right now as well so just looking to scale that out I'm doing some design work right now with

um some other companies and and yeah hopefully the platform will have a couple more courses and have a nice uh uh makeover by the end of the summer sounds

all good

Will Vincent

and then are you still gonna stick um do you think to the uh per course um pattern or how do you you know as a content creator how do you think about I mean because I think about this obviously all the time as well subscription versus um kind of pay as you go given that you're now building out a platform.

Michael Herman

Haven't really thought too much about that probably just continue to do this pay as you go.

Setting up subscriptions that's uh going to be a lot of development work.

So yeah I'd say if I wanted to go that route it'd probably be you know three to six months worth of development to change that workflow.

Will Vincent

Oh wow okay um

Michael Herman

well also I'm not working on test driven full time and you know that's part of the reason why that would take a long time

Will Vincent

got it um I guess uh so I think there's there's maybe a couple more things just on the stack itself um again because I think this is such a great chance to look at a newly built stack um what are you using for I don't know for for DNS are you using Heroku or using something special to handle DNS?

Michael Herman

Uh so it's a combination of oh it's actually Frankenstein together I I hate DNS so it's a combination of Dreamhost, Cloudflare, Heroku, and Netlify was in there for a bit and I got Netlify out of there so I'm using Cloudflare Heroku and Dreamhost.

This is just for resolving your your your um host name right yes right well okay

Will Vincent

well so why you know why do you have three like what what what was not working that caused you to add these all in right because if I'm you know I'm a new developer and I read you know one of your tutorials or Django for beginners I just I can put a site up with SSL on Heroku problem solved.

Like what's not solved when you're actually at at a production level?

Michael Herman

Because I bought the domain name through uh a different company and then started out with Netlify deploys and then went to netlify DNS and then wanted to move to Heroku uh and so I transferred the domain name once and screwed up DNS for about six hours transferred it back.

It was uh yeah I don't know if you want to go down this route but it was it was definitely a nightmare.

Will Vincent

Yeah yeah no just at a high level I think it's just

Carlton Gibson

but when when DNS goes wrong it really goes wrong right yeah it's yeah

Will Vincent

fair enough well uh speaking of um uh so monitoring right um are you using any sort of uh you know uh app specific monitoring or uptime monitoring because there's a whole you know suite of tools for that are are you using any of those as well?

Michael Herman

Yeah for uptime monitoring I don't remember I'm using the uptime robot or something like that.

The platform doesn't really go down at this point so uh which has been nice I think I've gotten like one email in the past um like six months about the site like going down but it was immediately back up so might have been a false negative but or

Will Vincent

Heroku something or other

Michael Herman

yeah so yeah uptime robot um using accommodation of uh new relic uh sentry and log entries and you know all that comes from the uh Heroku add-on um um

Heroku add-ons and then you know post Postgres and and Redis.

Carlton Gibson

Yeah so do you are you doing some kind of APM application performance monitoring with

Michael Herman

oh uh yeah yeah I'm using like new new relic right um I guess new relic is handling that yeah

Carlton Gibson

and that gives you a like a breakdown of um the request time where it's spent in different parts of your code and things like that.

Michael Herman

Oh actually Heroku gives you a lot of that information.

Does it interest the like the the straight Heroku dashboard will give you a number um of nice key metrics like that.

Will Vincent

For logging um because we've we're meaning to do an episode on logging on the podcast we haven't yet what um like how deep are your logs?

What sort of stuff are you logging right?

Because this is sort of an extra step on top of your your tests uh or can you talk through how you've how you thought about logging in terms of building out the you know Django side yeah

Michael Herman

whenever I'm doing a try accept or uh try catch that's generally I'm throwing um the logger in there uh you know certain things like you know transactions in terms of strike payments I'm throwing um the logger in there uh let's see where else it's kind of I haven't really thought

too much about that and that's you know definitely something there's a backlog for tickets to clean up the logger uh going back to the application performance monitoring I'm using Scout for that um that just hit me so that's another add-on uh that you get from Roku uh and Sentry is used for like the exception monitoring so that's that's anytime an error is thrown and it bubbles up then sentry will catch that and uh send me emails and whatnot.

Will Vincent

Yeah so it's quite I mean it's quite a lot of just for you know listeners to get a sense of all these tools you know for on the spectrum a relatively straightforward application you're using you know well over a dozen tools third party tools right either free or paid to help you monitor and process just pretty standard web app flows, emails and all the rest.

Michael Herman

Yeah and I am on the free tiers for all those monitoring services.

They come out of the box uh with Heroku and so yeah Heroku just allows me to be able to just focus on my application and not have to worry about infrastructure at all.

I would say Heroku gets expensive quick but I'm a single person development team I'm not gonna hire a DevOps person anytime soon so I'm happy to pay whatever they tell me.

Carlton Gibson

Yeah that's the great question right that's that's because you know what's your hourly rate what's your how would how much would it cost you to hire a developer to to do these things?

How much do you save?

Carlton Gibson

And the these platforms of the services the the the sort of the that you do the Psalms you know well that's quite expensive but all the things you don't have to do well what did you save?

And you know we talked to Tom Dyson and you know he made the comment that you know these from Wagtail Torchbox um Wagtail fame and he made the point that um you know the if you really do the maths and you include the developer time you can scale these things quite a long way before they they become uneconomical.

Will Vincent

And I believe um Torchbox which you know major major uh agency they use Heroku for most of their um client work actually

Carlton Gibson

yeah for exactly these reasons right yeah

Michael Herman

yeah I mean that's sort of one of the reasons why Python came into existence was like to optimize for the developer time.

Will Vincent

Yeah you know exactly um so I uh there was one other uh thing I've s I've noticed on your site.

You have um for search, um this is relevant because um by the time episode comes out, it'll be announced that I'm giving a talk at uh DjangoCon on search.

Can you talk about how you went through that process of search and um because search is such a deep field and you've got a nice search implementation.

How did you go about that?

Michael Herman

I think from the end user perspective, it may look nice, but it's very, very janky in the code.

So I'm not doing anything um uh fancy in there, and actually I haven't looked at that code in like three or four months.

Carlton Gibson

So I for me it's kind of interesting because you know there's this kind of pressure.

Oh, you've got to have Elasticsearch or whatever.

You know, you don't have to have Elasticsearch a lot of the time, you know.

You can do it with your database, and for a lot of sites, that's actually good enough.

Michael Herman

Yeah, I'm really just doing straight filters on like the content itself.

And so I guess it is doing a very janky flavor of full text search, but I'm not taking any advantage of any of like the full test full text speed uh full text search features that you get from either Django or Postgres.

Carlton Gibson

Right, okay, interesting.

Got it.

And y and yet from the end user perspective, it's quite effective.

Will Vincent

Yeah, it will it works fine as a just an end user, you know.

It I don't, you know, no complaints.

Michael Herman

It's yeah, it's a very, very basic search.

I have complaints about it, but I I'm a bit close to it, but uh yeah, I mean it's a just a very, very basic search.

There's not really any ordering to it.

Um so if you know you search for Docker and really it's just going to like sort that based on like the date.

So you know, there might be a blog post with 15 instances of Docker.

There might be a blog post that comes um you know after that that has uh one hit for Docker, and it's going to you know sort that based on the date.

So it's it's not even like concerned about how many different instances of Docker showed up showing up.

So it's a very, very naive uh search.

Carlton Gibson

Okay, but um you know I mean if if if it's good enough for the size of the content that you've got and it serves for the users, then that's not I I think this is really interesting just because it's a problem that we see all the time in technology.

We're always tempted to um gold plate it.

We're tempted to do the thing which is the absolute um best engineering standards when it's a lot of times it's not needed.

Michael Herman

Yeah, given the unlimited amount of time, I would definitely definitely focus on it.

And I do get a lot of emails, uh people asking, not directly about search, but indirectly, in the sense of like, do you talk about this in the course or do you talk about you know that?

And or where do you mention blah blah blah?

And in my head, I'm like, well, use the search, and then I'm like, Well, the search isn't all that great, so maybe I shouldn't tell them that.

Will Vincent

Okay.

Yeah.

That is nice, I guess, versus a well, I guess you can search a PDF as well.

I was gonna say you can point them to search and they can you know if they have the course, they can search through and and find it.

Though I guess if they don't if they haven't purchased the course, they only get what the first the first couple parts or chapters, they don't get the full thing.

So that would probably be why they would ask you that question.

Michael Herman

Yeah, that makes sense, yeah.

Will Vincent

Yeah.

So uh something else you're involved in, which we haven't mentioned yet, is your um conferences.

I mean, you speak a lot, but then also um Pi Colorado is coming up this fall, which you're involved with.

Uh, do you want to speak by that at all?

Michael Herman

Yeah, so Pi Colorado is uh early September, so that's September 6th, 7th, and 8th.

Uh the norm the main conference is gonna be the 7th and 8th, that's uh Saturday and Sunday, and then there's uh a workshop day uh that's similar to the PyCon workshops that's going to be on Friday the 6th.

So I'm the program chair, so I am organizing all the talks, all the speakers, and all of the workshops.

Will Vincent

Wow.

Well that's quite a bit of work.

Michael Herman

Yeah, and so the next weekend I'm actually getting married, and so I'm kind of uh September's gonna be a little crazy for me.

Will Vincent

Yeah.

And do you know uh are you gonna be able to attend DjangoCon, which I think is later later that month?

I don't know.

Michael Herman

Depends on what things look like maybe mid-September.

Yeah.

I'm probably not gonna make a decision on that for a while.

Will Vincent

So we've talked a lot about uh Django.

Maybe just to circle back to what we started with, um what are you've worked with so many different frameworks.

You've mentioned Flask, Rails, Express.

How do you think of you know which one to choose?

Like what are some cases where you know Flask is very well suited to something versus Rails or maybe Express?

Are there some examples that come to mind where you would pick a specific framework for a specific task?

Or would you start with a language?

Michael Herman

Yeah, I mean I would start with definitely the language and figure out you know which which language you're gonna be coding in, because if you're in, you know, if you're coding Ruby, you're probably not gonna want to use Django.

But I'm not not sure how to answer that question.

But uh yeah, I mean some of the some of the use cases that I look for um in terms of Flask versus Django, I look at project size, I look at the the type of application, um, I also look at the uh the size of the team.

Um I'd say the application type is is is is a big one.

So you know, a website versus a web app uh versus a web service.

And I know not not everything is is uh cleanly bucketed you know into those three different things, but let's say a website is just static generated.

A web app is a full stack uh web application, it could be you know single page application, it could be uh something of server-side templating, and a web service is just could be just just a basic RESTful API.

So I like to think think in terms of those buckets.

And so if it's a website um that's just static generated, probably not gonna use Django for that.

So if it's a web app, um Django you know is great for that.

I think the Jam stack over the the past couple years, the um JavaScript uh APIs markup, uh sort of the Netlify stack, uh the serverless type type stack, uh is kind of eating away in into uh sort of uh Django's dominance as a you know as a web application framework.

And then uh sort of a web service, uh I like to use either Django or Flask for that.

Carlton Gibson

Yeah, I I've built I spent a lot of time playing with stacks like generators and even Jam stack types of things, and found myself constantly coming back to Django.

Why?

Because every time I was like, oh well now I need a web form.

And now I know Netlify does this kind of thing now, but it's like, oh now I need a web form, or now I need authors now, and it was like always the case where I just had saved myself a little bit of time setting up my Django app and writing my first template view by just slapping up our HTML page, but then I had to go and retrofit it all every time, and it was like, ah, do you know what?

I give up on that.

And I found myself more and more just like I I'm not gonna experiment with the static site generated for this project because it's just gonna cost me time in the medium term.

Will Vincent

Well, partly you I mean, uh that's also given that you know Django so well, once you know any tool, whatever framework it is, you can kind of make it do what you want, and then do you need to re you know, relearn the wheel?

Carlton Gibson

Um, exactly.

And and and using like you know an alternative microframework, it's like it's always more time for me digging in the docs to to learn the other API than it is to just use Django.

But again, I guess that's familiarity.

Michael Herman

Yeah.

Yeah, I mean that's a that's a good point.

I don't I don't think it's ever a good uh it's ever a good time when you're when you're working on a project to experiment with something new.

Just go with what you're familiar with.

It's it's easy, it's a lot easier to estimate how long it's gonna take to complete something.

And you know, maybe dabble here and there in some uh with some toy projects uh outside like a you know a project um that you're doing for for work or uh freelance or whatever.

But that's a good time when to like spin up like, hey, how can I actually rekeate recreate like this full Django web application using Netlify or Flask and serverless and whatnot.

So it's

Carlton Gibson

always worth giving every new framework a run and seeing what it does and seeing it's the way it approaches things because it it it you know it makes you a better developer overall because you know different approaches and different styles and

Michael Herman

yeah, exactly.

Will Vincent

Well, so maybe as a uh concluding point, um the title of your course is microservices um with what flask, React, Docker.

Um how do you think about microservices?

Uh you know, when do you because I think I know you've worked with those professionally, but in terms of for your own, you know, for test driven, did you think about a microservices approach or where do you um how do you how do you think about microservices?

Just to give you a broad question.

When are they appropriate?

Like what what what are they what problems do they solve and what problems do they cause?

Because you know, they're typically used in larger companies.

Um you don't necessarily usually see a startup go with microservices.

Michael Herman

Yeah, I mean uh to relate that back to Django and Flask, the uh the 2018 JetBrains um you know develop Python developer survey came when that came out, Flask was actually slightly ahead in terms of popularity uh than Django.

And I don't know if that's you know just because that's you know, jet brain users in general, but I would say that's more of the web development industry and the trend toward the smaller frameworks, the microservices and the serverless uh platforms the past uh four or five years or so.

And you know, I guess going back directly to your question, microservices, um, I mean, they're they can be good.

They're not they're not like gonna fix, you know, like if you have a lot of problems in your company, um, if your development uh uh if your development teams are very siloed, it's not gonna fix that by any means.

Uh you you definitely need to address uh some of those softer skills first.

But microservices can um help.

Um it can help uh scale certain pieces of your application that get a lot of traffic um it can help with you know isolating you know bits and pieces of your application to de decouple it from you know other processes and whatnot so that can run independently it can be scaled independently so I I know microservices is is uh kind of a it's obviously a trend these days and you know there's a lot of you know questions um about it and you know how to go about it and micro micro front end frameworks or whatever

like has been a trend on uh Twitter the past like week and that seems bonkers to me but maybe uh next year this time I'll be talking more about you know micro web micro front end frameworks or you know whatever people are called micro front ends I think is the term um yeah but yeah but the but but the the sort of sorry I was gonna say so like the problems that you have with micro front ends is and the same with microservices um micro back ends or whatever is that the core state so how do you

how are you maintaining state across those applications if you if you need to and you know ideal world you wouldn't have to do that you could be able to scale and deploy all those things and you wouldn't have to worry about shared state but there's going to be a certain amount of shared state and that's um huge problem.

Will Vincent

Well and I think you would you had said at some point um Michael that you thought one of the things about micro uh microservices is that it shifted the complexity away from the individual developer kind of up a level to the um I guess the maybe the the SRE the site reliability engineer um do you recall saying that?

Is that something you want to expand on?

Because I thought Yeah you

Michael Herman

can quote you can quote me on that.

Will Vincent

Well it's it I it struck me when you mentioned that because it did seem like you do have this issue of if you you know it doesn't necessarily solve the problem but it moves it from the hands of an individual engineer who may have you know who knows how many years of experience they have maybe it kicks it up in a large site where you do have entire teams around site reliability and deployment and you know they can maybe are forced to handle some of those issues rather than giving that power to an individual engineer who can do something silly in a monolithic uh framework setting.

Michael Herman

Yeah I mean smaller code bases are easier to work with yeah and so if you break apart your monolith into smaller code bases you're gonna have in theory you're gonna have less bugs you're gonna be able to move faster product likes that uh developers like working on on on things like that but then the problem is function calls now become network calls and so you have to deal with that at the infrastructure level so you're shifting that complexity away from the individual developers more to

wards the DevOps the sysadmin the uh SRE team

Will Vincent

well so as we come to the end here we've talked a lot about how you build test driven with Django and your thoughts on Flask do you have any concluding thoughts on you know developers looking at you know Flask or Django and um how to think about that choice?

Michael Herman

Yeah I I think that you really need to look at sort of the application type versus time the the amount of time it you have to develop something and there's going to obviously be some trade-offs there.

Think about what you can absolutely not compromise on and then base your decision on that.

And based on that sometimes you'll choose Django other times you'll choose Flask and that doesn't make one better than the other I mean they're really used to achieve the same things building web applications.

They just have uh very different approaches or the the means are are different.

Will Vincent

Yeah exactly and I you know goal of this podcast is not to just relentlessly beat the drum on Django but to try to be honest and open about its strengths and why people choose other things and just let people have that choice but at the same time not be fall into the trap that I think a lot of beginners see experienced developers do which is just to say it depends all the time.

So I appreciate that you've been you know sort of backed up the choices you've made and building out test driven because ultimately a a choice has to be made um you know many choices even for a basic website.

Carlton Gibson

Yeah like you gotta choose your database.

You gotta choose your web server you've got to choose your hosting you've got to choose like these you've got to choose your language you've got to go

Will Vincent

anyway at some level you know it just becomes you just choose what you're used to as we've mentioned before but it's also worth knowing what else is out there and also having uh if someone says why did you use XYZ say oh well you know sometimes it's good to reevaluate your decisions because things uh frameworks do change um new features are added um but hopefully Django will just stay mature and just keep getting

more and more awesome.

Michael Herman

Yeah and and Django definitely decreases the amount of decisions you have to make same with a Roku.

Carlton Gibson

Yes yes any any opinionated thing it gives you a it gives you some guide rails and not you know gives you rails.

Will Vincent

So yeah and especially as you mentioned when you're a solo developer in a small team you you you don't have the luxury of um making all those little decisions.

So thank you so much for joining us.

If listeners want to reach out to you what's the best way Michael

Michael Herman

so Twitter is probably the best way um at Mike Herman you can also reach me via email at Michael at testdriven.io

Will Vincent

great well thank you so much for taking the time and uh it's been really educational to hear how you've built out test driven with Django.

Carlton Gibson

Yeah thanks for coming on the show.

Michael Herman

Yeah much appreciated thank you

Will Vincent

okay bye