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
BIN
docs/_static/debugger.png
vendored
Normal file
BIN
docs/_static/debugger.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
|
|
@ -97,6 +97,13 @@ Both will have exactly the same effect.
|
||||||
major security risk and **must never be used on production machines**
|
major security risk and **must never be used on production machines**
|
||||||
because of that.
|
because of that.
|
||||||
|
|
||||||
|
Screenshot of the debugger in action:
|
||||||
|
|
||||||
|
.. image:: _static/debugger.png
|
||||||
|
:align: center
|
||||||
|
:class: screenshot
|
||||||
|
:alt: screenshot of debugger in action
|
||||||
|
|
||||||
|
|
||||||
Routing
|
Routing
|
||||||
-------
|
-------
|
||||||
|
|
|
||||||
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):
|
class Flask(object):
|
||||||
"""The flask object implements a WSGI application and acts as the central
|
"""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
|
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
|
self.package_name = package_name
|
||||||
|
|
||||||
#: where is the app root located?
|
#: where is the app root located?
|
||||||
self.root_path = os.path.abspath(os.path.dirname(
|
self.root_path = _get_package_path(self.package_name)
|
||||||
sys.modules[self.package_name].__file__))
|
|
||||||
|
|
||||||
#: a dictionary of all view functions registered. The keys will
|
#: a dictionary of all view functions registered. The keys will
|
||||||
#: be function names which are also used to generate URLs and
|
#: be function names which are also used to generate URLs and
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue