Skip to content
Myr

docs: ``DEBUG``, ``SERVER_NAME``, ``PATH_INFO``

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

authored by defuz · committed by defuz · parent 02694d6 · Browse files · 11 files+28 added−28 removed
This commit

State

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

Diff stats

11 files+28 added−28 removed

  • other:+28 added−28 removed

11 files+28 added−28 removed

modified:docs/deploying/fastcgi.rst+1 added-1 removed
180 unmodified lines
181 }182183This configuration binds the application to `/yourapplication`. If you184want to have it in the URL root it's a bit simpler because you don't185have to figure out how to calculate `PATH_INFO` and `SCRIPT_NAME`::185have to figure out how to calculate ``PATH_INFO`` and ``SCRIPT_NAME``::186187 location / { try_files $uri @yourapplication; }188 location @yourapplication {189 include fastcgi_params;
51 unmodified lines
modified:docs/deploying/uwsgi.rst+1 added-1 removed
51 unmodified lines
52 }5354This configuration binds the application to `/yourapplication`. If you want55to have it in the URL root it's a bit simpler because you don't have to tell56it the WSGI `SCRIPT_NAME` or set the uwsgi modifier to make use of it::56it the WSGI ``SCRIPT_NAME`` or set the uwsgi modifier to make use of it::5758 location / { try_files $uri @yourapplication; }59 location @yourapplication {60 include uwsgi_params;
7 unmodified lines
modified:docs/deploying/wsgi-standalone.rst+2 added-2 removed
72 unmodified lines
73------------7475If you deploy your application using one of these servers behind an HTTP proxy76you will need to rewrite a few headers in order for the application to work.77The two problematic values in the WSGI environment usually are `REMOTE_ADDR`78and `HTTP_HOST`. You can configure your httpd to pass these headers, or you77The two problematic values in the WSGI environment usually are ``REMOTE_ADDR``78and ``HTTP_HOST``. You can configure your httpd to pass these headers, or you79can fix them in middleware. Werkzeug ships a fixer that will solve some common80setups, but you might want to write your own WSGI middleware for specific81setups.82
51 unmodified lines
modified:docs/patterns/fabric.rst+1 added-1 removed
140 unmodified lines
141The Configuration File142----------------------143144Now as mentioned above, the application will find the correct145configuration file by looking up the `YOURAPPLICATION_CONFIG` environment145configuration file by looking up the ``YOURAPPLICATION_CONFIG`` environment146variable. So we have to put the configuration in a place where the147application will able to find it. Configuration files have the unfriendly148quality of being different on all computers, so you do not version them149usually.
47 unmodified lines
modified:docs/patterns/fileuploads.rst+3 added-3 removed
30 unmodified lines
31 app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER3233So first we need a couple of imports. Most should be straightforward, the34:func:`werkzeug.secure_filename` is explained a little bit later. The35`UPLOAD_FOLDER` is where we will store the uploaded files and the36`ALLOWED_EXTENSIONS` is the set of allowed file extensions. Then we add a35``UPLOAD_FOLDER`` is where we will store the uploaded files and the36``ALLOWED_EXTENSIONS`` is the set of allowed file extensions. Then we add a37URL rule by hand to the application. Now usually we're not doing that, so38why here? The reasons is that we want the webserver (or our development39server) to serve these files for us and so we only need a rule to generate40the URL to these files.
56 unmodified lines
9798 filename = "../../../../home/username/.bashrc"99100 Assuming the number of ``../`` is correct and you would join this with101 the `UPLOAD_FOLDER` the user might have the ability to modify a file on101 the ``UPLOAD_FOLDER`` the user might have the ability to modify a file on102 the server's filesystem he or she should not modify. This does require some103 knowledge about how the application looks like, but trust me, hackers104 are patient :)105
85 unmodified lines
modified:docs/config.rst+3 added-3 removed
55 unmodified lines
56``TESTING`` enable/disable testing mode57``PROPAGATE_EXCEPTIONS`` explicitly enable or disable the58 propagation of exceptions. If not set or59 explicitly set to ``None`` this is60 implicitly true if either `TESTING` or61 `DEBUG` is true.60 implicitly true if either ``TESTING`` or61 ``DEBUG`` is true.62``PRESERVE_CONTEXT_ON_EXCEPTION`` By default if the application is in63 debug mode the request context is not64 popped on exceptions to enable debuggers65 to introspect the data. This can be
193 unmodified lines
259 app.config.from_envvar('YOURAPPLICATION_SETTINGS')260261This first loads the configuration from the262`yourapplication.default_settings` module and then overrides the values263with the contents of the file the :envvar:`YOURAPPLICATION_SETTINGS`263with the contents of the file the :envvar:``YOURAPPLICATION_SETTINGS``264environment variable points to. This environment variable can be set on265Linux or OS X with the export command in the shell before starting the266server::267
195 unmodified lines
modified:flask/app.py+8 added-8 removed
196 unmodified lines
197 #: application. In debug mode the debugger will kick in when an unhandled198 #: exception occurs and the integrated server will automatically reload199 #: the application if changes in the code are detected.200 #:201 #: This attribute can also be configured from the config with the `DEBUG`201 #: This attribute can also be configured from the config with the ``DEBUG``202 #: configuration key. Defaults to ``False``.203 debug = ConfigAttribute('DEBUG')204205 #: The testing flag. Set this to ``True`` to enable the test mode of
4 unmodified lines
210 #: If this is enabled and PROPAGATE_EXCEPTIONS is not changed from the211 #: default it's implicitly enabled.212 #:213 #: This attribute can also be configured from the config with the214 #: `TESTING` configuration key. Defaults to ``False``.214 #: ``TESTING`` configuration key. Defaults to ``False``.215 testing = ConfigAttribute('TESTING')216217 #: If a secret key is set, cryptographic components can use this to218 #: sign cookies and other things. Set this to a complex random value219 #: when you want to use the secure cookie for instance.220 #:221 #: This attribute can also be configured from the config with the222 #: `SECRET_KEY` configuration key. Defaults to ``None``.222 #: ``SECRET_KEY`` configuration key. Defaults to ``None``.223 secret_key = ConfigAttribute('SECRET_KEY')224225 #: The secure cookie uses this for the name of the session cookie.226 #:227 #: This attribute can also be configured from the config with the228 #: `SESSION_COOKIE_NAME` configuration key. Defaults to ``'session'``228 #: ``SESSION_COOKIE_NAME`` configuration key. Defaults to ``'session'``229 session_cookie_name = ConfigAttribute('SESSION_COOKIE_NAME')230231 #: A :class:`~datetime.timedelta` which is used to set the expiration232 #: date of a permanent session. The default is 31 days which makes a233 #: permanent session survive for roughly one month.234 #:235 #: This attribute can also be configured from the config with the236 #: `PERMANENT_SESSION_LIFETIME` configuration key. Defaults to236 #: ``PERMANENT_SESSION_LIFETIME`` configuration key. Defaults to237 #: ``timedelta(days=31)``238 permanent_session_lifetime = ConfigAttribute('PERMANENT_SESSION_LIFETIME',239 get_converter=_make_timedelta)240
3 unmodified lines
244 #:245 #: .. versionadded:: 0.2246 #:247 #: This attribute can also be configured from the config with the248 #: `USE_X_SENDFILE` configuration key. Defaults to ``False``.248 #: ``USE_X_SENDFILE`` configuration key. Defaults to ``False``.249 use_x_sendfile = ConfigAttribute('USE_X_SENDFILE')250251 #: The name of the logger to use. By default the logger name is the252 #: package name passed to the constructor.
306 unmodified lines
559 return self.import_name560561 @property562 def propagate_exceptions(self):563 """Returns the value of the `PROPAGATE_EXCEPTIONS` configuration563 """Returns the value of the ``PROPAGATE_EXCEPTIONS`` configuration564 value in case it's set, otherwise a sensible default is returned.565566 .. versionadded:: 0.7567 """
3 unmodified lines
571 return self.testing or self.debug572573 @property574 def preserve_context_on_exception(self):575 """Returns the value of the `PRESERVE_CONTEXT_ON_EXCEPTION`575 """Returns the value of the ``PRESERVE_CONTEXT_ON_EXCEPTION``576 configuration value in case it's set, otherwise a sensible default577 is returned.578579 .. versionadded:: 0.7
1330 unmodified lines
modified:flask/ctx.py+1 added-1 removed
207 unmodified lines
208 The request context is automatically popped at the end of the request209 for you. In debug mode the request context is kept around if210 exceptions happen so that interactive debuggers have a chance to211 introspect the data. With 0.4 this can also be forced for requests212 that did not fail and outside of `DEBUG` mode. By setting212 that did not fail and outside of ``DEBUG`` mode. By setting213 ``'flask._preserve_context'`` to ``True`` on the WSGI environment the214 context will not pop itself at the end of the request. This is used by215 the :meth:`~flask.Flask.test_client` for example to implement the216 deferred cleanup functionality.
179 unmodified lines
modified:flask/helpers.py+1 added-1 removed
243 unmodified lines
244245 :param endpoint: the endpoint of the URL (name of the function)246 :param values: the variable arguments of the URL rule247 :param _external: if set to ``True``, an absolute URL is generated. Server248 address can be changed via `SERVER_NAME` configuration variable which248 address can be changed via ``SERVER_NAME`` configuration variable which249 defaults to `localhost`.250 :param _scheme: a string specifying the desired URL scheme. The `_external`251 parameter must be set to ``True`` or a `ValueError` is raised. The default252 behavior uses the same scheme as the current request, or
651 unmodified lines
modified:flask/wrappers.py+1 added-1 removed
60 unmodified lines
61 _is_old_module = False6263 @property64 def max_content_length(self):65 """Read-only view of the `MAX_CONTENT_LENGTH` config key."""65 """Read-only view of the ``MAX_CONTENT_LENGTH`` config key."""66 ctx = _request_ctx_stack.top67 if ctx is not None:68 return ctx.app.config['MAX_CONTENT_LENGTH']69
132 unmodified lines
modified:CHANGES+6 added-6 removed
337 unmodified lines
338 was not reliable and caused issues on Google's App Engine. Until339 1.0 the old behavior will continue to work but issue dependency340 warnings.341- fixed a problem for Flask to run on jython.342- added a `PROPAGATE_EXCEPTIONS` configuration variable that can be342- added a ``PROPAGATE_EXCEPTIONS`` configuration variable that can be343 used to flip the setting of exception propagation which previously344 was linked to `DEBUG` alone and is now linked to either `DEBUG` or345 `TESTING`.344 was linked to ``DEBUG`` alone and is now linked to either ``DEBUG`` or345 ``TESTING``.346- Flask no longer internally depends on rules being added through the347 `add_url_rule` function and can now also accept regular werkzeug348 rules added to the url map.349- Added an `endpoint` method to the flask application object which
99 unmodified lines
449Released on July 6th 2010, codename Calvados450451- fixed a bug with subdomains that was caused by the inability to452 specify the server name. The server name can now be set with453 the `SERVER_NAME` config key. This key is now also used to set453 the ``SERVER_NAME`` config key. This key is now also used to set454 the session cookie cross-subdomain wide.455- autoescaping is no longer active for all templates. Instead it456 is only active for ``.html``, ``.htm``, ``.xml`` and ``.xhtml``.457 Inside templates this behavior can be changed with the
23 unmodified lines
481 for a little longer. This can also be used to trigger custom482 requests that do not pop the request stack for testing.483- because the Python standard library caches loggers, the name of484 the logger is configurable now to better support unittests.485- added `TESTING` switch that can activate unittesting helpers.486- the logger switches to `DEBUG` mode now if debug is enabled.485- added ``TESTING`` switch that can activate unittesting helpers.486- the logger switches to ``DEBUG`` mode now if debug is enabled.487488Version 0.3.1489-------------490
48 unmodified lines