Skip to Content
Flask Framework Cookbook - Second Edition
book

Flask Framework Cookbook - Second Edition

by Shalabh Aggarwal
July 2019
Beginner to intermediate
302 pages
9h 38m
English
Packt Publishing
Content preview from Flask Framework Cookbook - Second Edition

Getting started

OAuth 2 only works with SSL, so the application should run with HTTPS. To do this on a local machine, please follow these steps:

  1. Install pyopenssl using the $ pip3 install pyopenssl command.
  2. Add additional options to app.run() , including ssl_context with the value adhoc. The completed app.run should look as follows: app.run(debug=True, ssl_context='adhoc').
  3. Once these changes have been made, run the application using the URL https://localhost:5000/. Before the app loads, your browser will display warnings about the certificate not being safe. Just accept the warning and proceed.
This is not a recommended method. In production systems, SSL certificates should be obtained from a proper certifying authority.

To install Flask-Dance ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Writing a Web Application with Flask

Writing a Web Application with Flask

Doug Farrell
Mastering Flask

Mastering Flask

Jack Stouffer

Publisher Resources

ISBN: 9781789951295Supplemental Content