r/learnpython • • Mar 01 '21

Python is kicking my butt

I’ve been learning python since early December now.. I seemed to become comfortable with the syntax and was gaining confidence quickly!

Then I moved on to Django and was quickly sent a reality check as the difficulty level increased really fast... I went back to python and started learning classes... this also is extremely hard to grasp..

While learning classes I realized I didn’t know for loops.. dictionaries.. len/range() nearly as much as I thought I did... the confidence I so quickly built is now gone.

I know the journey to web dev isn’t going to be easy at all.. I’m not giving up.. just wanted to get this off my chest.. I’m going back to the basics this week. Wish me luck. Have a nice week!

486 Upvotes

118 comments sorted by

View all comments

0

u/[deleted] Mar 01 '21

[deleted]

2

u/thedjotaku djotaku Mar 01 '21

Depends what you want to do. I started a Flask app and eventually found myself developing a bunch of stuff that comes "for free" with Django. So I'm in the process of restarting that project.

On the other hand, this weekend I knocked out a Flask app to serve as a webhook endpoint and Flask was 100% perfect for the job and I was able to get the MVP out in a couple hours and something that added a bunch of QoL additions by the end of the weekend.

2

u/Ran4 Mar 02 '21

FastAPI is actually a MUCH better for any type of json api.

Flask, like Django, defaults to sending back html in responses for example. You need to override lots of stuff in both Flask and Django to make them nice as json apis.

Fastapi has typed input/outputs by default, is async by default, returns sensible json at all times and automatically generates OpenAPI 3.0 documentation (served at /docs).

Django still has a superior ORM and database management (FastAPI requires you to hack it together yourself using something like sqlalchemy+alembic, both of which are strictly inferior to Django's systems) though. But there's just little reason to recommend flask for anyone nowadays.

1

u/thedjotaku djotaku Mar 02 '21

The Talk Python To Me/Python Bytes guy has been talking a lot about FastAPI, but I didn't have any experience with it. I'll have to take a look.