You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: docs/index.rst
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ The **Flask-Script** extension provides support for writing external scripts in
9
9
10
10
# manage.py
11
11
12
-
from flask.ext.script import Manager
12
+
from flask_script import Manager
13
13
14
14
from myapp import app
15
15
@@ -57,7 +57,7 @@ with lots of commands you might want to split them into a number of files with r
57
57
In your ``manage.py`` file you have to create a ``Manager`` instance. The ``Manager`` class
58
58
keeps track of all the commands and handles how they are called from the command line::
59
59
60
-
from flask.ext.script import Manager
60
+
from flask_script import Manager
61
61
62
62
app = Flask(__name__)
63
63
# configure your app
@@ -81,7 +81,7 @@ The next step is to create and add your commands. There are three methods for cr
81
81
To take a very simple example, we want to create a ``hello`` command that just prints out "hello world". It
82
82
doesn't take any arguments so is very straightforward::
83
83
84
-
from flask.ext.script import Command
84
+
from flask_script import Command
85
85
86
86
class Hello(Command):
87
87
"prints hello world"
@@ -186,7 +186,7 @@ or alternatively::
186
186
187
187
To facilitate this you use the ``option_list`` attribute of the ``Command`` class::
188
188
189
-
from flask.ext.script import Command, Manager, Option
189
+
from flask_script import Command, Manager, Option
190
190
191
191
class Hello(Command):
192
192
@@ -381,7 +381,7 @@ Getting user input
381
381
382
382
**Flask-Script** comes with a set of helper functions for grabbing user input from the command line. For example::
383
383
384
-
from flask.ext.script import Manager, prompt_bool
384
+
from flask_script import Manager, prompt_bool
385
385
386
386
from myapp import app
387
387
from myapp.models import db
@@ -411,7 +411,7 @@ runserver
411
411
412
412
The ``Server`` command runs the **Flask** development server.::
413
413
414
-
from flask.ext.script import Server, Manager
414
+
from flask_script import Server, Manager
415
415
from myapp import create_app
416
416
417
417
manager = Manager(create_app)
@@ -452,7 +452,7 @@ shell
452
452
453
453
The ``Shell`` command starts a Python shell. You can pass in a ``make_context`` argument, which must be a ``callable`` returning a ``dict``. By default, this is just a dict returning the your Flask application instance::
454
454
455
-
from flask.ext.script import Shell, Manager
455
+
from flask_script import Shell, Manager
456
456
457
457
from myapp import app
458
458
from myapp import models
@@ -597,12 +597,12 @@ Error handling
597
597
598
598
Users do not like to see stack traces, but developers want them for bug reports.
599
599
600
-
Therefore, ``flask.ext.script.commands`` provides an `InvalidCommand` error
600
+
Therefore, ``flask_script.commands`` provides an `InvalidCommand` error
601
601
class which is not supposed to print a stack trace when reported.
602
602
603
603
In your command handler::
604
604
605
-
from flask.ext.script.commands import InvalidCommand
0 commit comments