|
|
|
@ -466,8 +466,12 @@ def send_from_directory(directory, filename, **options):
|
|
|
|
|
return send_file(filename, conditional=True, **options) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_package_path(name): |
|
|
|
|
"""Returns the path to a package or cwd if that cannot be found.""" |
|
|
|
|
def get_root_path(name): |
|
|
|
|
"""Returns the path to a package or cwd if that cannot be found. This |
|
|
|
|
returns the path of a package or the folder that contains a module. |
|
|
|
|
|
|
|
|
|
Not to be confused with the package path returned by :func:`find_package`. |
|
|
|
|
""" |
|
|
|
|
try: |
|
|
|
|
return os.path.abspath(os.path.dirname(sys.modules[name].__file__)) |
|
|
|
|
except (KeyError, AttributeError): |
|
|
|
@ -549,7 +553,7 @@ class _PackageBoundObject(object):
|
|
|
|
|
self.template_folder = template_folder |
|
|
|
|
|
|
|
|
|
#: Where is the app root located? |
|
|
|
|
self.root_path = get_package_path(self.import_name) |
|
|
|
|
self.root_path = get_root_path(self.import_name) |
|
|
|
|
|
|
|
|
|
self._static_folder = None |
|
|
|
|
self._static_url_path = None |
|
|
|
|