| Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
Frameworks are collections of classes, functions, and constants designed to make completing a task easier.
Types of frameworks include:
To take care of the boring stuff.
Use a framework if you are making a cookie cutter application.
If a framework exists for what you’re doing, consider using it.
Things to keep in mind when looking for a framework:
Good frameworks usually have:
- Good documentation
- Active developers
- A helpful community
There are two types of websites: Static and Dynamic.
@app.route('/accounts/<account_name>', methods=['DELETE'])
def delete_account(account_name):
if authenticated() and authorized():
database.remove_account(account_name)
return 'Success', 200
else
return 'Failure', 401
<!DOCTYPE HTML>
<html>
<head>
<title>Template Example</title>
</head>
<body>
<p>Your lucky number today is {{ number }}!</p>
</body>
</html>
render_template("template.html", number=random.randint(0, 99))
Your lucky number today is 42!
...
<body>
{% for message in messages %}
<p>{{ message }}</p>
{% endfor %}
</body>
...
messages = ["Welcome!", "Test Message", "Vim > Emacs"]
render_template("template2.html", messages=messages)
Welcome!
Test Message
Vim > Emacs
GET http://web.site/page.html HTTP/1.1
HTTP/1.1 200 OK
Content-Type: text/html
...
<!DOCTYPE HTML>
...