Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics What a View! What Are URLs?

Why is Django so much harder!

Ive been trying to learn python and python its self the syntax has been pretty easy to learn over all but when its coming down to learning Django I am so lost there are so many files and so much code is already wrote that I don't understand when a new Django project is created. In Python Basics I was so lost close to the end of the courses where we would make a game all the code was pretty easy to learn but when it came for it all to come together in one project I could not understand how each line was link to another line of code so I skip it and went to the next thing to learn. at the rate im going im starting to think I should stop learning to program...

1 Answer

Jeff Muday
Jeff Muday
Treehouse Moderator 28,372 Points

Django is a professional framework with the ability to produce professional quality websites with the least amount of effort.


*Django is not the easiest framework to learn because it includes so much-- routing, administrative interface, object relational mapper (ORM), etc. * At first, Django has a very "black box" feel when you begin using it, you don't have to understand what is going on fully to make working applications. However, you do have to conform to the "Django way" of doing things.

If you want to take a slightly gentler introduction to Python frameworks, then you should study Flask. Flask makes it easy to have a 1-file app. There are excellent Treehouse courses on it. With Flask, the programmer has more decisions to make-- what kind of database to use, how to implement security, etc. I have written major applications in Flask that are just as robust as those built by Django. What's nice is that this framework can easily run on a Raspberry Pi or other IoT computer, but can scale to running high performance websites with thousands of hits per hour!

The "Flask Basics" course on Treehouse is excellent, probably the best one you will find anywhere!


If you're interested in the Ruby language, you might want to take a look at "Building web apps with Sinatra." Again, this has excellent content worth your time.


Here's what a very simple Hello World with two routes program would look like on Flask. I took the liberty of commenting the featured functionality.

from flask import Flask

# instantiate the Flask app
app = Flask(__name__)

# declare a route /
def hello():
    return "Hello World from Flask!"

# declare a route /greet with a url parameter (e.g. /greet/Dakota)
def greet(name):
    return "Hi there " + name

# starts the app that serves as a host to any client on port 8000
app.run(host='', port=8000)
Mark Sebeck
Mark Sebeck
Treehouse Moderator 36,475 Points

Great write up Jeff. I was just getting ready to ask a question whether I should learn Django or Flask first. I clearly see Flask is best place for me to start. Thanks!