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
Provenance
- Commit
ad011bc- Tree
61ea76e- Author
defuz <defuz.net@gmail.com>- Committer
defuz <defuz.net@gmail.com>- Parent
02694d6
11 files changed+28 added−28 removed
modified:docs/deploying/fastcgi.rst+1 added-1 removed
180 unmodified lines181 }182 183 This configuration binds the application to `/yourapplication`. If you184 want to have it in the URL root it's a bit simpler because you don't185-have to figure out how to calculate `PATH_INFO` and `SCRIPT_NAME`::185+have to figure out how to calculate ``PATH_INFO`` and ``SCRIPT_NAME``::186 187 location / { try_files $uri @yourapplication; }188 location @yourapplication {189 include fastcgi_params;51 unmodified linesmodified:docs/deploying/uwsgi.rst+1 added-1 removed
51 unmodified lines52 }53 54 This configuration binds the application to `/yourapplication`. If you want55 to have it in the URL root it's a bit simpler because you don't have to tell56-it the WSGI `SCRIPT_NAME` or set the uwsgi modifier to make use of it::56+it the WSGI ``SCRIPT_NAME`` or set the uwsgi modifier to make use of it::57 58 location / { try_files $uri @yourapplication; }59 location @yourapplication {60 include uwsgi_params;7 unmodified linesmodified:docs/deploying/wsgi-standalone.rst+2 added-2 removed
72 unmodified lines73 ------------74 75 If you deploy your application using one of these servers behind an HTTP proxy76 you will need to rewrite a few headers in order for the application to work.77-The two problematic values in the WSGI environment usually are `REMOTE_ADDR`78-and `HTTP_HOST`. You can configure your httpd to pass these headers, or you77+The two problematic values in the WSGI environment usually are ``REMOTE_ADDR``78+and ``HTTP_HOST``. You can configure your httpd to pass these headers, or you79 can fix them in middleware. Werkzeug ships a fixer that will solve some common80 setups, but you might want to write your own WSGI middleware for specific81 setups.82 51 unmodified linesmodified:docs/patterns/fabric.rst+1 added-1 removed
140 unmodified lines141 The Configuration File142 ----------------------143 144 Now as mentioned above, the application will find the correct145-configuration file by looking up the `YOURAPPLICATION_CONFIG` environment145+configuration file by looking up the ``YOURAPPLICATION_CONFIG`` environment146 variable. So we have to put the configuration in a place where the147 application will able to find it. Configuration files have the unfriendly148 quality of being different on all computers, so you do not version them149 usually.47 unmodified linesmodified:docs/patterns/fileuploads.rst+3 added-3 removed
30 unmodified lines31 app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER32 33 So 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 a37 URL rule by hand to the application. Now usually we're not doing that, so38 why here? The reasons is that we want the webserver (or our development39 server) to serve these files for us and so we only need a rule to generate40 the URL to these files.56 unmodified lines97 98 filename = "../../../../home/username/.bashrc"99 100 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 linesmodified:docs/config.rst+3 added-3 removed
55 unmodified lines56 ``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 be193 unmodified lines259 app.config.from_envvar('YOURAPPLICATION_SETTINGS')260 261 This first loads the configuration from the262 `yourapplication.default_settings` module and then overrides the values263-with the contents of the file the :envvar:`YOURAPPLICATION_SETTINGS`263+with the contents of the file the :envvar:``YOURAPPLICATION_SETTINGS``264 environment variable points to. This environment variable can be set on265 Linux or OS X with the export command in the shell before starting the266 server::267 195 unmodified linesmodified:flask/app.py+8 added-8 removed
196 unmodified lines197 #: 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')204 205 #: The testing flag. Set this to ``True`` to enable the test mode of4 unmodified lines210 #: 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')216 217 #: 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')224 225 #: 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')230 231 #: 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 lines244 #: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')250 251 #: The name of the logger to use. By default the logger name is the252 #: package name passed to the constructor.306 unmodified lines559 return self.import_name560 561 @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.565 566 .. versionadded:: 0.7567 """3 unmodified lines571 return self.testing or self.debug572 573 @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.578 579 .. versionadded:: 0.71330 unmodified linesmodified:flask/ctx.py+1 added-1 removed
207 unmodified lines208 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 linesmodified:flask/helpers.py+1 added-1 removed
243 unmodified lines244 245 :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, or651 unmodified linesmodified:flask/wrappers.py+1 added-1 removed
60 unmodified lines61 _is_old_module = False62 63 @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 linesmodified:CHANGES+6 added-6 removed
337 unmodified lines338 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 which99 unmodified lines449 Released on July 6th 2010, codename Calvados450 451 - 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 the23 unmodified lines481 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.487 488 Version 0.3.1489 -------------490 48 unmodified lines