Flask-Script

2.0.6 · deprecated · verified Wed Apr 15

Flask-Script is a Python extension for Flask that provided support for writing external scripts, including running a development server, a customized Python shell, database setup scripts, and other command-line tasks. The project's last release was in September 2017 (version 2.0.6), and its maintainers are no longer actively developing new features, only merging pull requests. It has largely been superseded by Flask's built-in command-line interface (Flask CLI), which uses the Click library.

Warnings

Install

Imports

Quickstart

This quickstart creates a simple 'manage.py' script that initializes a Flask app with a Flask-Script Manager and adds a custom 'hello' command. Run it using `python manage.py hello` to see 'Hello, world!' printed.

from flask import Flask
from flask_script import Manager, Command

app = Flask(__name__)

class HelloCommand(Command):
    """Says hello."""
    def run(self):
        print("Hello, world!")

manager = Manager(app)
manager.add_command("hello", HelloCommand())

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

view raw JSON →