Added __main__ module

This commit is contained in:
Armin Ronacher 2014-04-21 17:52:04 +02:00
parent 8a46eec4f8
commit 1b06c8a411
2 changed files with 30 additions and 1 deletions

15
flask/__main__.py Normal file
View file

@ -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)

View file

@ -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 sys
from threading import Lock
@ -164,7 +175,10 @@ def main(as_module=False):
this_module = __package__ + '.run'
if as_module:
name = 'python -m ' + this_module
if sys.version_info >= (2, 7):
name = 'python -m ' + this_module.rsplit('.', 1)[0]
else:
name = 'python -m ' + this_module
else:
name = 'flask-run'