I basically want to make a small personal website that probably won’t get any attention. It will also be somewhat simple. Is Django overkill and I should use Flask or something else or is it okay? I tried learning JS and using ExpressJS but JS overall feels very loosely typed and I don’t like it. I’ve been using Python for over 3 years now.
No, you should use whatever you want instead.
Seriously, don’t worry about it. You want to use Django? Use Django! You want to use flask? Use flask!
Yes! If you’re comfortable with Django, that’ll definitely work, not overkill at all.
If you’re down to get your hands dirty with JS, Astro is really easy to learn and can be extremely powerful if needed. TypeScript or JSDoc will give you the types in JavaScript you’re looking for, and that’s built-in to Astro too. SvelteKit is similar to Astro’s syntax but has more powerful server-side tools built-in and is my personal favorite.
Up to you, really just depends on how much you want to learn.
Sure! I like using larger frameworks anyway because they typically come with a lot of nice features you might miss on the smaller ones. Personal preference.
Once you learn Django, is it easy to get a simple website to get running? How is its performance? I am planning on using templates heavily, is it ok?
Once you learn Django, is it easy to get a simple website to get running?
You can get a local install of Hello World running in minutes. Same thing for a Docker instance.
How is its performance?
It’s performant enough that if you are asking this, it probably doesn’t matter for your use-case.
I am planning on using templates heavily, is it ok?
Yes, that’s how you use Django. Since you asked about performance though, one area where Django’s performance can degrade is if you start trying to add too much logic in the views. Follow the Model, View, Control structure and keep logic in the control layer as much as you can.
Sure yeah, it’s not hard really. There is some background you’ll need to learn, like adding a view or working with models, but when you learn it, you’ll be glad you did. Templates are a great reason to use Django.
Performance is great. Of course, the real performance isn’t really with Django itself, but how you use it. For example, if you write expensive database queries, your app will be slower.
Great thanks for your help.
You bet! Good luck!
What about HTML? Or a tool that renders such from Markdown?
I need a dynamic website
Re: JS, I use Express with TypeScript for strict types. It’s really nice, but, it doesn’t have much in the way of built in features. You kind of have to bolt everything on yourself.
Maybe.
JS overall feels very loosely typed and I don’t like it
Yep, as someone with 20+ years of JS experience it’s pretty bad. There are hoops you can jump through to improve things but they add complexity and don’t really fix the fundamentals.
Django is an OK choice.
Personally I would go for Laravel and PHP. In my opinion the latest version of PHP is a better language than Python (that wasn’t true with old versions of PHP) and I prefer Laravel over Django because it’s more modular and generally easier to build exactly what you want, without being influenced by the framework. Laravel is only “opinionated” in areas that will not limit your project.
You will have to build your own back end/dashboard in Laravel though. That’s not much work but in particular make sure you get your login system right.
Whichever way you go, I highly recommend paying for ChatGPT+ and using that instead of google/stack overflow/lemmy as the first place you go to look up how to do something. Here’s an example where I asked for a basic hello world project, then asked to expand it with Eloquent and Blade (to fetch from a database and output a html page): https://chat.openai.com/c/60ef78f4-13a6-4e62-ab7c-da4603ffed52
I started out on django and ended up switching to flask for all my python backends, but it depends on what exactly you want. Django is very hand-holdy and does some of the work of setting up new pages/routes for you, however that does put you on rails a little bit compared to flask. Flask is more performant and customizable, but it’s slightly more effort to get going in my opinion.
Was there a noticeable performance improvement on flask or what kind of features did you need that django didn’t provide? I’ve always used bigger enterprise frameworks for webapps and only recently started looking into Django for smaller personal ones so I’m wondering what are the differences
I’ll be honest, the only reason I originally switched was because I needed to learn flask for a work thing. I didn’t really notice any major differences in performance, but it was a pretty light website at that point anyway. I do prefer flask now, but that might just be because I’ve used it more.
Hmm, having googled very superficially about django and flask, it seems to me like the state (at least today) is the opposite - flask is lightweight and django is more heavy duty, having a built in ORM layer, authentication service, admin interface, db migration framework, etc.
To be fair the article also says Django is known for its performance but when I googled that the other day, it looked like it was often near the bottom of the chart rather than top… I guess it really comes down to personal preference in the end 🤷♂️
Do you want a website or a webapp? Website, just stick with nginx + wordpress or something. If you actually want to write a webapp, then django should be fine. I have also used fastapi which was very easy to start with. If it’s a personal web app, then the performance will never really be a problem (unless it grows into something more). So I would pick whatever you can find example code for, and just run with it.