Skip to content
Myr

Merge pull request #2344 from davidism/application-root

Before adoption: this commit came in with the history the project adopted, so no landing records it.

APPLICATION_ROOT defaults to '/'

authored by David Lord · committed by GitHub · parents 60feecc, 4a53840 · Browse files · 4 files+9 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+9 added−6 removed

  • other:+9 added−6 removed

4 files+9 added−6 removed

modified:flask/app.py+2 added-2 removed
305 unmodified lines
306 'USE_X_SENDFILE': False,307 'LOGGER_NAME': None,308 'LOGGER_HANDLER_POLICY': 'always',309 'SERVER_NAME': None,310 'APPLICATION_ROOT': None,310 'APPLICATION_ROOT': '/',311 'SESSION_COOKIE_NAME': 'session',312 'SESSION_COOKIE_DOMAIN': None,313 'SESSION_COOKIE_PATH': None,314 'SESSION_COOKIE_HTTPONLY': True,
1529 unmodified lines
1844 # to work.1845 if self.config['SERVER_NAME'] is not None:1846 return self.url_map.bind(1847 self.config['SERVER_NAME'],1848 script_name=self.config['APPLICATION_ROOT'] or '/',1848 script_name=self.config['APPLICATION_ROOT'],1849 url_scheme=self.config['PREFERRED_URL_SCHEME'])18501851 def inject_url_defaults(self, endpoint, values):1852 """Injects the URL defaults for the given endpoint directly into
237 unmodified lines
modified:flask/sessions.py+2 added-2 removed
286 unmodified lines
287 default implementation uses the value from the ``SESSION_COOKIE_PATH``288 config var if it's set, and falls back to ``APPLICATION_ROOT`` or289 uses ``/`` if it's ``None``.290 """291 return app.config['SESSION_COOKIE_PATH'] or \292 app.config['APPLICATION_ROOT'] or '/'291 return app.config['SESSION_COOKIE_PATH'] \292 or app.config['APPLICATION_ROOT']293294 def get_cookie_httponly(self, app):295 """Returns True if the session cookie should be httponly. This296 currently just returns the value of the ``SESSION_COOKIE_HTTPONLY``
131 unmodified lines
modified:flask/testing.py+2 added-2 removed
32 unmodified lines
33 ), 'Cannot pass "subdomain" or "url_scheme" with "base_url".'3435 if base_url is None:36 http_host = app.config.get('SERVER_NAME') or 'localhost'37 app_root = app.config.get('APPLICATION_ROOT') or '/'37 app_root = app.config['APPLICATION_ROOT']3839 if subdomain:40 http_host = '{0}.{1}'.format(subdomain, http_host)4142 if url_scheme is None:43 url_scheme = app.config.get('PREFERRED_URL_SCHEME') or 'http'43 url_scheme = app.config['PREFERRED_URL_SCHEME']4445 url = url_parse(path)46 base_url = '{0}://{1}/{2}'.format(47 url_scheme, url.netloc or http_host, app_root.lstrip('/')
114 unmodified lines
modified:CHANGES+3 added
47 unmodified lines
48- Factory functions are not required to take a ``script_info`` parameter to49 work with the ``flask`` command. If they take a single parameter or a50 parameter named ``script_info``, the ``ScriptInfo`` object will be passed.51 (`#2319`_)52- FLASK_APP=myproject.app:create_app('dev') support. 53- ``FLASK_APP`` can be set to an app factory, with arguments if needed, for54 example ``FLASK_APP=myproject.app:create_app('dev')``. (`#2326`_)55- ``View.provide_automatic_options = True`` is set on the view function from56 ``View.as_view``, to be detected in ``app.add_url_rule``. (`#2316`_)
2 unmodified lines
59- ``Cookie`` is added to the response's ``Vary`` header if the session is60 accessed at all during the request (and it wasn't deleted). (`#2288`_)61- ``app.test_request_context()`` take ``subdomain`` and ``url_scheme``62 parameters for use when building base URL. (`#1621`_)63- Set ``APPLICATION_ROOT = '/'`` by default. This was already the implicit64 default when it was set to ``None``.6566.. _#1489: https://github.com/pallets/flask/pull/148967.. _#1621: https://github.com/pallets/flask/pull/162168.. _#1898: https://github.com/pallets/flask/pull/1898
635 unmodified lines