O'Reilly logo

Instant Flask Web Development by Ron DuPlain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Routing URLs and accepting requests (Simple)

This section will connect URLs to Python functions in our web service.

Getting ready

Use the project layout listed under the Project Layout section in the Running a Simple Application recipe.

How to do it...

  1. The Flask app object includes a route decorator to specify URL rules to use for a view function conveniently, which provides a declarative style for routing requests to Python callables. The following code routes five URL handling functions for the list, detail, creation, updating, and deletion of appointment records in our scheduling application. For now, we simply return a string describing what the handler is going to do, which we'll implement later, so that you can see the URL routing in action ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required