Browse Source

Added screenshot of the debugger to Flask docs. Flask now runs from the

shell again.
pull/1638/head
Armin Ronacher 15 years ago
parent
commit
40e0024d7b
  1. BIN
      docs/_static/debugger.png
  2. 7
      docs/quickstart.rst
  3. 11
      flask.py

BIN
docs/_static/debugger.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

7
docs/quickstart.rst

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

@ -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…
Cancel
Save