Book Image

Flask Framework Cookbook

By : Shalabh Aggarwal
Book Image

Flask Framework Cookbook

By: Shalabh Aggarwal

Overview of this book

Table of Contents (19 chapters)
Flask Framework Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Deploying with Apache


First, we will learn how to deploy a Flask application with Apache, which is, unarguably, the most popular HTTP server. For Python web applications, we will use mod_wsgi, which implements a simple Apache module that can host any Python applications that support the WSGI interface.

Note

Remember that mod_wsgi is not the same as Apache and needs to be installed separately.

Getting ready

We will start with our catalog application and make appropriate changes to it to make it deployable using the Apache HTTP server.

First, we should make our application installable so that our application and all its libraries are on the Python load path. This can be done using a setup.py script, as seen in the Making a Flask app installable using setuptools recipe in Chapter 1, Flask Configurations. There will be a few changes to the script as per this application. The major changes are mentioned here:

packages=[
    'my_app',
    'my_app.catalog',
],
include_package_data=True,
zip_safe = False...