Statics¶
Classes¶
Statics¶
Statics.
Unfortunately you cannot live without serving static files via some protocol (HTTP, SPDY or something else). Fortunately uWSGI has a wide series of options and micro-optimizations for serving static files.
Note
This subsystem automatically honours the If-Modified-Since HTTP request header.
DIR_DOCUMENT_ROOT¶
Used to check for static files in the requested DOCUMENT_ROOT. Pass into static_dir.
add_expiration_rule¶
-
Criterion (subject) to base expiration on.
1See ``.expiration_criteria``. -
Value to test criteria upon.
1.. note:: Usually a regular expression. -
Number of seconds to expire after.
-
Base on file modification time instead of the current time.
Adds statics expiration rule based on a criterion.
register_static_map¶
-
Append the requested resource to the docroot.
1 2 3 4 5
Example: if ``/images`` maps to ``/var/www/img`` requested ``/images/logo.png`` will be served from: * ``True``: ``/var/www/img/images/logo.png`` * ``False``: ``/var/www/img/logo.png`` -
Skip security checks if the file is under the specified path.
1 2 3
Whether to consider resolved (real) target a safe one to serve from. * <http://uwsgi.readthedocs.io/en/latest/StaticFiles.html#security>
Allows mapping mountpoint to a static directory (or file).
set_basic_params¶
-
Check for static files in the specified directory.
1.. note:: Use ``DIR_DOCUMENT_ROOT`` constant to serve files under ``DOCUMENT_ROOT``. -
Search for specified file if a directory is requested.
1Example: ``index.html`` -
Set mime types file path to extend uWSGI builtin list.
1Default: ``/etc/mime.types`` or ``/etc/apache2/mime.types``. -
Skip specified extension from static file checks.
1Example: add ``.php`` to not serve it as static. -
Set static file serving (transfer) mode.
1 2 3
See ``.transfer_modes``. .. note:: Another option is to specify ``count_offload`` in ``.workers.set_thread_params()``.
set_paths_caching_params¶
Use the uWSGI caching subsystem to store mappings from URI to filesystem paths.
expiration_criteria¶
Expiration criteria (subjects) to use with .add_expiration_rule().
transfer_modes¶
File transfer (serving) modes.
With this, uWSGI will only generate response headers and the web server will be delegated to transferring the physical file.