Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install flask-failsafe

How to install Flask-Failsafe

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install flask-failsafe
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
0.1 Available View build log
Linux (64-bit)
0.1 Available View build log
 
Author
License
BSD
Dependencies
Imports
Lastest release
version 0.1 on Nov 23rd, 2012

Flask-Failsafe

A failsafe for the Flask reloader.

The Flask reloader works great until you make a syntax error and it fails importing your app. This extension helps keep you working smoothly by catching errors during the initialization of your app, and provides a failsafe fallback app to display those startup errors instead.

To use it, run your app via a small script script with a factory function to initialize your app:

from flask_failsafe import failsafe

@failsafe
def create_app():
  # note that the import is *inside* this function so that we can catch
  # errors that happen at import time
  from myapp import app
  return app

if __name__ == "__main__":
  create_app().run()

The @failsafe decorator catches any errors calling create_app() and returns a fallback app that will instead display the Flask error debugger.

If you use Flask-Script <http://flask-script.readthedocs.org>, you can pass the same @failsafe-decorated factory function to the Manager() class:

from flask.ext.script import Manager, Server
from flask_failsafe import failsafe

@failsafe
def create_app():
  from myapp import app
  return app

manager = Manager(create_app)
manager.add_command("runserver", Server())

if __name__ == "__main__":
  manager.run()

Changes

0.1 (2012-09-14)

Initial release

Subscribe to package updates

Last updated Nov 23rd, 2012

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.