forked from orbit-oss/flask
Added screenshot of the debugger to Flask docs. Flask now runs from the
shell again.
This commit is contained in:
parent
6dd92ae4b3
commit
40e0024d7b
3 changed files with 16 additions and 2 deletions
11
flask.py
11
flask.py
|
|
@ -153,6 +153,14 @@ def _default_template_ctx_processor():
|
|||
)
|
||||
|
||||
|
||||
def _get_package_path(name):
|
||||
"""Returns the path to a package or cwd if that cannot be found."""
|
||||
try:
|
||||
return os.path.abspath(os.path.dirname(sys.modules[name].__file__))
|
||||
except (KeyError, AttributeError):
|
||||
return os.getcwd()
|
||||
|
||||
|
||||
class Flask(object):
|
||||
"""The flask object implements a WSGI application and acts as the central
|
||||
object. It is passed the name of the module or package of the
|
||||
|
|
@ -213,8 +221,7 @@ class Flask(object):
|
|||
self.package_name = package_name
|
||||
|
||||
#: where is the app root located?
|
||||
self.root_path = os.path.abspath(os.path.dirname(
|
||||
sys.modules[self.package_name].__file__))
|
||||
self.root_path = _get_package_path(self.package_name)
|
||||
|
||||
#: a dictionary of all view functions registered. The keys will
|
||||
#: be function names which are also used to generate URLs and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue