Hacker News new | ask | show | jobs
by pbreit 3817 days ago
It's shocking to me how something that should be so easy becomes so complicated. Why does the file structure need to be re-configured? What the heck are the __init__ files?? Virtual environments?

I sort of know the answers but remain unsatisfied.

And then the author sets up a needlessly overcomplicated data model situation.

4 comments

With all due respect, this tutorial might be a little over your head, but a little bit of research will get you up to speed. __init__ files and virtual environments are not specific to Django or DRF. These are typical patterns used in python development. For example, using a virtual environment allows you to have a self-contained python environment (your choice of version) with package management through pip. This is enormously useful when writing apps--you've got python and dependencies all in one spot contained in its own environment.
As I mentioned, I know the answers. But that doesn't quell my dissatisfaction.
Write your own article ¯\_(ツ)_/¯
Django Rest Framework is hands down the easiest way to build an app I've ever seen. I can have a full API for most apps built in just a few hours.
can I ask a serious question? are you possibly not the intended audience of this article? have you done any non-beginner work using Python and/or Django in a production environment?
I'm slightly past this article but not much further. I check out a lot of "getting started" tutorials because I'm still frustrated with the "getting started" experience of a lot of frameworks/approaches. I just don't see why it's so complicated to do things that seem like they would be pretty easy.
How else would you suggest a python interpreter know to treat a directory as a module?
Why a computer couldn't figure that out (whatever that even means) is a total mystery to me. Makes no sense at all.
pretty standard stuff if you're familiar with python...
That's the scary part. How having blank __init__ files in every folder is "standard stuff" is beyond mortal comprehension.