@@ -18,20 +18,28 @@ The ``flask`` command is installed by Flask, not your application; it must be
1818told where to find your application in order to use it. The ``FLASK_APP ``
1919environment variable is used to specify how to load the application.
2020
21- Unix Bash (Linux, Mac, etc.) ::
21+ .. tabs ::
2222
23- $ export FLASK_APP=hello
24- $ flask run
23+ .. group-tab :: Bash
24+
25+ .. code-block :: text
26+
27+ $ export FLASK_APP=hello
28+ $ flask run
29+
30+ .. group-tab :: CMD
2531
26- Windows CMD::
32+ .. code-block :: text
2733
28- > set FLASK_APP=hello
29- > flask run
34+ > set FLASK_APP=hello
35+ > flask run
3036
31- Windows PowerShell::
37+ .. group-tab :: Powershell
3238
33- > $env:FLASK_APP = "hello"
34- > flask run
39+ .. code-block :: text
40+
41+ > $env:FLASK_APP = "hello"
42+ > flask run
3543
3644 While ``FLASK_APP `` supports a variety of options for specifying your
3745application, most use cases should be simple. Here are the typical values:
@@ -128,16 +136,49 @@ If the env is set to ``development``, the ``flask`` command will enable
128136debug mode and ``flask run `` will enable the interactive debugger and
129137reloader.
130138
131- ::
139+ .. tabs ::
132140
133- $ FLASK_ENV=development flask run
134- * Serving Flask app "hello"
135- * Environment: development
136- * Debug mode: on
137- * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
138- * Restarting with inotify reloader
139- * Debugger is active!
140- * Debugger PIN: 223-456-919
141+ .. group-tab :: Bash
142+
143+ .. code-block :: text
144+
145+ $ export FLASK_ENV=development
146+ $ flask run
147+ * Serving Flask app "hello"
148+ * Environment: development
149+ * Debug mode: on
150+ * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
151+ * Restarting with inotify reloader
152+ * Debugger is active!
153+ * Debugger PIN: 223-456-919
154+
155+ .. group-tab :: CMD
156+
157+ .. code-block :: text
158+
159+ > set FLASK_ENV=development
160+ > flask run
161+ * Serving Flask app "hello"
162+ * Environment: development
163+ * Debug mode: on
164+ * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
165+ * Restarting with inotify reloader
166+ * Debugger is active!
167+ * Debugger PIN: 223-456-919
168+
169+ .. group-tab :: Powershell
170+
171+ .. code-block :: text
172+
173+ > $env:FLASK_ENV = "development"
174+ > flask run
175+ * Serving Flask app "hello"
176+ * Environment: development
177+ * Debug mode: on
178+ * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
179+ * Restarting with inotify reloader
180+ * Debugger is active!
181+ * Debugger PIN: 223-456-919
141182
142183
143184 Watch Extra Files with the Reloader
@@ -149,14 +190,40 @@ additional files with the ``--extra-files`` option, or the
149190``FLASK_RUN_EXTRA_FILES `` environment variable. Multiple paths are
150191separated with ``: ``, or ``; `` on Windows.
151192
152- .. code-block :: none
193+ .. tabs ::
153194
154- $ flask run --extra-files file1:dirA/file2:dirB/
155- # or
156- $ export FLASK_RUN_EXTRA_FILES=file1:dirA/file2:dirB/
157- $ flask run
158- * Running on http://127.0.0.1:8000/
159- * Detected change in '/path/to/file1', reloading
195+ .. group-tab :: Bash
196+
197+ .. code-block :: text
198+
199+ $ flask run --extra-files file1:dirA/file2:dirB/
200+ # or
201+ $ export FLASK_RUN_EXTRA_FILES=file1:dirA/file2:dirB/
202+ $ flask run
203+ * Running on http://127.0.0.1:8000/
204+ * Detected change in '/path/to/file1', reloading
205+
206+ .. group-tab :: CMD
207+
208+ .. code-block :: text
209+
210+ > flask run --extra-files file1:dirA/file2:dirB/
211+ # or
212+ > set FLASK_RUN_EXTRA_FILES=file1:dirA/file2:dirB/
213+ > flask run
214+ * Running on http://127.0.0.1:8000/
215+ * Detected change in '/path/to/file1', reloading
216+
217+ .. group-tab :: Powershell
218+
219+ .. code-block :: text
220+
221+ > flask run --extra-files file1:dirA/file2:dirB/
222+ # or
223+ > $env:FLASK_RUN_EXTRA_FILES = "file1:dirA/file2:dirB/"
224+ > flask run
225+ * Running on http://127.0.0.1:8000/
226+ * Detected change in '/path/to/file1', reloading
160227
161228
162229 Debug Mode
@@ -206,11 +273,31 @@ environment variables. The variables use the pattern
206273``FLASK_COMMAND_OPTION ``. For example, to set the port for the run
207274command, instead of ``flask run --port 8000 ``:
208275
209- .. code-block :: bash
276+ .. tabs ::
210277
211- $ export FLASK_RUN_PORT=8000
212- $ flask run
213- * Running on http://127.0.0.1:8000/
278+ .. group-tab :: Bash
279+
280+ .. code-block :: text
281+
282+ $ export FLASK_RUN_PORT=8000
283+ $ flask run
284+ * Running on http://127.0.0.1:8000/
285+
286+ .. group-tab :: CMD
287+
288+ .. code-block :: text
289+
290+ > set FLASK_RUN_PORT=8000
291+ > flask run
292+ * Running on http://127.0.0.1:8000/
293+
294+ .. group-tab :: Powershell
295+
296+ .. code-block :: text
297+
298+ > $env:FLASK_RUN_PORT = 8000
299+ > flask run
300+ * Running on http://127.0.0.1:8000/
214301
215302 These can be added to the ``.flaskenv `` file just like ``FLASK_APP `` to
216303control default command options.
@@ -234,10 +321,28 @@ a project runner that loads them already. Keep in mind that the
234321environment variables must be set before the app loads or it won't
235322configure as expected.
236323
237- .. code-block :: bash
324+ .. tabs ::
238325
239- $ export FLASK_SKIP_DOTENV=1
240- $ flask run
326+ .. group-tab :: Bash
327+
328+ .. code-block :: text
329+
330+ $ export FLASK_SKIP_DOTENV=1
331+ $ flask run
332+
333+ .. group-tab :: CMD
334+
335+ .. code-block :: text
336+
337+ > set FLASK_SKIP_DOTENV=1
338+ > flask run
339+
340+ .. group-tab :: Powershell
341+
342+ .. code-block :: text
343+
344+ > $env:FLASK_SKIP_DOTENV = 1
345+ > flask run
241346
242347
243348 Environment Variables From virtualenv
@@ -247,13 +352,25 @@ If you do not want to install dotenv support, you can still set environment
247352variables by adding them to the end of the virtualenv's :file: `activate `
248353script. Activating the virtualenv will set the variables.
249354
250- Unix Bash, :file: `venv/bin/activate `::
355+ .. tabs ::
356+
357+ .. group-tab :: Bash
358+
359+ Unix Bash, :file: `venv/bin/activate `::
360+
361+ $ export FLASK_APP=hello
362+
363+ .. group-tab :: CMD
364+
365+ Windows CMD, :file: `venv\\ Scripts\\ activate.bat `::
366+
367+ > set FLASK_APP=hello
251368
252- $ export FLASK_APP=hello
369+ .. group-tab :: Powershell
253370
254- Windows CMD , :file: `venv\\ Scripts\\ activate.bat `::
371+ Windows Powershell , :file: `venv\\ Scripts\\ activate.ps1 `::
255372
256- > set FLASK_APP= hello
373+ > $env: FLASK_APP = " hello"
257374
258375It is preferred to use dotenv support over this, since :file: `.flaskenv ` can be
259376committed to the repository so that it works automatically wherever the project
0 commit comments