Browse Source

Added __main__ module

pull/1030/head
Armin Ronacher 11 years ago
parent
commit
1b06c8a411
  1. 15
      flask/__main__.py
  2. 14
      flask/run.py

15
flask/__main__.py

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
"""
flask.__main__
~~~~~~~~~~~~~~
Alias for flask.run for the command line.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
if __name__ == '__main__':
from run import main
main(as_module=True)

14
flask/run.py

@ -1,3 +1,14 @@
# -*- coding: utf-8 -*-
"""
flask.run
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os import os
import sys import sys
from threading import Lock from threading import Lock
@ -164,6 +175,9 @@ def main(as_module=False):
this_module = __package__ + '.run' this_module = __package__ + '.run'
if as_module: if as_module:
if sys.version_info >= (2, 7):
name = 'python -m ' + this_module.rsplit('.', 1)[0]
else:
name = 'python -m ' + this_module name = 'python -m ' + this_module
else: else:
name = 'flask-run' name = 'flask-run'

Loading…
Cancel
Save