Register to get access to free programming courses with interactive exercises

Fullstack frameworks Key Aspects of Web Development in Python

The Flask framework, which we looked at the beginning of the course, belongs to the class of so-called microframeworks. All of them, in one way or another, are clones of the Ruby framework Sinatra, which set the trend for microframeworks. See how similar the code structure is:

Ruby:

# Ruby
require 'sinatra'
get '/frank-says' do
  'Put this in your pipe & smoke it!'
end

Java:

// Java
import static spark.Spark.*;

public class HelloWorld {
    public static void main(String[] args) {
        get("/hello", (req, res) -> "Hello World");
    }
}

JavaScript:

// JavaScript
import Express from 'express';
const app = new Express();

app.get('/', (req, res) => res.send('Hello World!'));

Python:

# Python
from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

They're all like twin brothers in defining routes and setting handlers. Apart from basic functionality, there's nothing in microframeworks. We install everything else separately.

Moving away from microframeworks, consider full-fledged frameworks — large packages of code. It comes with everything you might need out of the box. They're usually easy to extend because of the many add-ons available on GitHub. The history of web frameworks dates back to 2004, when the first version of Ruby On Rails, a Ruby language framework, was released. Rails was ahead of its time and set the tone for many years. Many modern web frameworks are clones of Rails in one way or another.

In Ruby, you could say there is nothing else except Rails, and it positively affects development because everyone is running in the same direction. The situation is similar in Python: Django is the default framework, although there have been other comparable frameworks at different times (Zope, Plone, WebRu, and others).

Here is a summary of the features that modern frameworks have:

  • Code generation. Any complete framework will contain a utility that allows you to generate code from the command line, such as for tests or migrations
  • Built-in mechanisms for testing. In other words, the framework allows you to start writing tests with almost no need to install or configure anything else
  • ORM. Either their own or one that's popular for the language as a whole
  • Templating engine and helpers (which are functions) for repetitive output tasks
  • Abstractions for working with letters
  • Internationalization and localization tool (we should integrate all other framework parts with i18n)
  • Security mechanisms, such as CQRS
  • Caching

Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

About Hexlet learning process

For full access to the course you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.bookmate">Bookmate</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.healthsamurai">Healthsamurai</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.dualboot">Dualboot</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.abbyy">Abbyy</span>
Suggested learning programs
profession
new
Developing web applications with Django
10 months
from scratch
under development
Start at any time

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Toto Image

Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.