Flask

Demo

This directory is a brief example and starter app for Flask, ready to deploy on ZEIT Now.

To get started with this project yourself, use the following command from Now CLI:

$ now init python-flask

Alternatively, create a project, and Git repository, with this example template using the ZEIT dashboard.

Once initialized locally, you will see the files /index.py and /about/index.py which each correspond to a route, / and /about, respectively. Each file defines a Flask wildcard catch-all so that we can utilize the routing layer in the Now Platform defined in now.json.

In this case, no routes are defined in now.json, so we can rely on the filesystem for routing.

To deploy this application, with Now installed, run the following from your terminal:

$ now

Alternatively, your new Flask app can be automatically deployed and aliased using Now for GitHub or Now for GitLab. Pushing these files to a new repository with a now.json file in the root, and with either Now for GitHub or Now for GitLab configured for that repository, means your site will be automatically deployed for every push and pull/merge request, and aliased for every push to the default branch!

Included In This Starter

This starter project includes:

  • A /index.py file that responds to the / route.
  • A /about/index.py file that responds to the /about route.
  • A pre-defined Pipfile that installs Flask as a dependency and defines the Python runtime version.
  • A generated Pipfile.lock that ensures exact versions of dependencies to avoid the risk of automatically upgrading packages that depend upon each other and breaking your project dependency tree.

Resources

For more resources on how to configure your new Flask app to do more with Now or to deploy any other kind of application, see the following:

For more information on Flask itself, see their documentation.