forked from orbit-oss/flask
Added __main__ module
This commit is contained in:
parent
8a46eec4f8
commit
1b06c8a411
2 changed files with 30 additions and 1 deletions
15
flask/__main__.py
Normal file
15
flask/__main__.py
Normal 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)
|
||||||
16
flask/run.py
16
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,7 +175,10 @@ def main(as_module=False):
|
||||||
this_module = __package__ + '.run'
|
this_module = __package__ + '.run'
|
||||||
|
|
||||||
if as_module:
|
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:
|
else:
|
||||||
name = 'flask-run'
|
name = 'flask-run'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue