Simplifying Django
programming.oreilly.com
programming.oreilly.com
The problem is not one of dealing with bloat, but balancing a potentially intimidating setup process with the need for showing results to new programmers or programmers moving between frameworks.
If you want to emphasize results, then you should first develop a TemplateView and then work your way from there to discuss Forms and finally Models/ModelForms. Things like configuring your settings, URLs and views should stay as they are, as bringing them all together into one file encourages a disorganized mess in the future.
In my case, I made a bunch of Flask apps, and while quick easy and fun, in my inexperience things quickly descended into a disorganized mess. Now that I've struggled with that, I understand the purpose of the structure of frameworks like Django or RoR. I have more perspective because I didn't jump in to the high level straight away.
Now, that's not to say this is the only way to learn, or the right way to learn. I just think it was a nice thing to learn, and tangentially related to the topic at hand.
There was a moment many friends of mine started building their apps on Flask. They loved the freedom it afforded them.
Every app of this series has grown into something that user more or less the full Django feature set. All of those friends of mine ended um having to build their own Django, piece by piece.
There is a valuable lesson here: chances are your app will grow to need a full framework. Unless you can build a better framework, you should stick to one that covers the most common use cases.
Also, every other framework seems like a mess now :D You get a sensible structure with Django when you start a new project.
https://mediacru.sh/jgc9B7eS1dDl
DON'T do this. Some of us speed readers read with selection. Completely shatters usability.
Instant hatred of the website. This is like reading a book where the pages are slimey and smell bad.
For someone new to programming, and new to developing web apps, the tutorial can be intimidating because you read about a bunch of parts that don't show anything through the browser for a while. This approach is different; it puts everything in one file so the student can see something in the browser right away, and then builds complexity on top of that. If done well, this is a really good approach. I expect that, in the more complete development of this approach, the student ends up with a project similar to what we see in the official tutorial. Taking a simplified, single-file approach and then pulling out the pieces as you add complexity is a perfectly reasonable pedagogical approach. I think this approach can even work for people coming at Django with experience in other languages and frameworks. The authors are not pretending that Django is simpler than it is; they are just presenting it in a simplified way initially, with the full intention of getting into all the necessary parts to build a complete application.
I think we also need to remember that when we write tutorials and books about Django, we are really preparing our readers and students to dig into the overall Django documentation for themselves. That documentation is thorough, and if readers leave this book with an ability to make sense of the official documentation, the authors have done their job.
Such a person is going to have a hard time regardless. I think it's much better to become proficient in a single (Turing-complete) language first.
The Web is a total mess -- a typical web application requires you to know, at a minimum, HTML, CSS, JS, your server-side language of choice, regular expressions, and SQL.
Django on the other hand is for more experienced web developers that want to do things correctly. And it adds another layer of complexity on to the list of technologies you mentioned.
For one, Django isn't a micro-framework and using it as such, although possible, is probably overkill.
Anybody who has ever seen an MVC pattern or read about it will understand why it needs 6 parts and won't necessarily be intimidated by it. I know I wasn't when I first looked at it.
On-boarding new users needs to be simple and welcoming, nobody disputes that. But this trend in dumbing down everything should not extend to web frameworks in my humble opinion.
I think the Django tutorial is an excellent piece of documentation. If somebody doesn't have enough patience to work through it, they probably won't have the time to read the rest of the docs either and will most likely end up writing messy code.
There is a reason most tutorials start with: this is how you show something, and if you want to sawe data here's how to make ane use a database. Sure doing it the other way around seems natural to you and other web developers, but it's a bad way to introduce a framework to a complete newbie.
Making the first step simple will just make it even more frustrating later when they don't understand concepts like objects, modules, packages, inheritance, DRY, separation of concerns, best practices, yadda.
Any programmer should be able to write down a minimal example of whatever they're working on, but personally I had never thought through how to make a minimal django app -- had you?
Replacing current project template, though, doesn't make sense IMO (and OP isn't suggesting that anyway). Default project should be suitable for the majority of use cases, and the current one seems to deal with that role well. Giving such a simplified template to a person without much discipline with regards to code organization would probably result in poorly maintainable pile down the line.
You can get quickly started with a bunch of languages without doing any setup, which is ideal for people learning to code.
Here's also a short installation guide (for Ubuntu):
http://blog.crudzilla.com/2014/04/hivemind-on-digital-ocean-...
This is coming from someone who writes a lot of PHP.
I have worked with Django a bit, but I've never built anything in Flask. Does Flask use an ORM, or do people need to write their own SQL?
That being said, you should absolutely at least learn the basics of working directly with databases. ORMs are a leaky abstraction, and you will run into situations where it's easier to drop into raw SQL to get the job done. Think of it like this: using GPS while driving is fine 95% of the time, but when it malfunctions or breaks, you're screwed unless you know how to read a map or ask for directions ;)
Using raw SQL instead of an ORM is one of the best examples of premature optimization I can think of (unless you are very very good at SQL and have a very complicated structure).
I don't use Django these days but the hard part I remember was using signal. Getting deep into the core to fit needs is hard of any framework.
There are many tutorials just covering the basics of the framework. Then the author stops because eventually the complex stuff like handling long computation, message queue, openid/oauth/ldap integration, load balancer are very project dependent. While that's true, and every tool's author must have some "tutorial" on how to use his or her tool, but this independence (or shall I say decentralized) can be a burden on beginner.
I am very much like to think we should have a book that can cover more tool integration.
For example, someone might want to use django with cassandra. The current default tutorial would discourage a user from doing that as it gives the impression that a SQL backend is required.
Simpler, more decoupled tutorials might also attract a user base who have more modern ideas on how to use django in different environments. We certainly need those innovators to push things forward .. look at what they have done for javascript over time.