Configuration and Section¶
Configuration and Section are two types you'll have to mainly deal with.
Configuration¶
Configuration¶
Configuration is comprised from one or more Sections and could be represented in format natively supported by uWSGI.
Functions¶
format¶
-
Whether to print out formatted config.
-
Whether to add stamp data to the first configuration section.
-
Formatter alias to format options. Default: ini.
Applies formatting to configuration.
print_ini¶
Print out this configuration as .ini.
tofile¶
- Filepath to save configuration into. If not provided a temporary file will be automatically generated.
Saves configuration into a file and returns its path.
Convenience method.
----¶
Section¶
Section¶
Configuration section.
Options within configuration section are gathered into groups:
1 2 3 4 5 | |
Next to all public methods of groups are for setting configuration parameters. Such methods return section object to allow chaining.
You can pass options group basic parameters into (the following are all the same):
1 2 3 4 5 6 7 8 9 10 11 | |
Attributes¶
alarms¶
Alarms options group.
applications¶
Applications options group.
caching¶
Caching options group.
cheapening¶
Cheapening options group.
empire¶
Emperor and vassals options group.
locks¶
Locks options group.
logging¶
Logging options group.
main_process¶
Main process options group.
master_process¶
Master process options group.
monitoring¶
Monitoring options group.
networking¶
Networking options group.
project_name ¶
Project name (alias) to be used to differentiate projects. See .replace_placeholders().
python¶
Python options group.
queue¶
Queue options group.
routing¶
Routing related options group.
spooler¶
Spooler options group.
statics¶
Static file serving options group.
subscriptions¶
Subscription services options group.
workers¶
Workers options group.
Functions¶
as_configuration¶
- Configuration objects initializer arguments.
Returns configuration object including only one (this very) section.
bootstrap ¶
-
Data source name, e.g:
Note
Some schemas: fastcgi, http, https, raw, scgi, shared, udp, uwsgi, suwsgi, zeromq
-
Allows using shared sockets to bind to privileged ports. If not provided automatic mode is enabled: shared are allowed if current user is not root.
-
Additional initialization keyword arguments accepted by section type.
Constructs a section object performing its basic (default) configuration.
derive_from ¶
-
Section to derive from,
-
New section name.
Creates a new section based on the given.
env¶
-
Whether to unset this variable.
-
If True env variable will be set as soon as possible.
-
Whether we need to set this value for local environment too. This could be useful in embedded mode.
Processes (sets/unsets) environment variable.
If is not given in set mode value will be taken from current env.
get_runtime_dir¶
- Whether to return [system] default if not set.
Directory to store runtime files.
See .replace_placeholders()
Note
This can be used to store PID files, sockets, master FIFO, etc.
include¶
- File path or Section to include.
Includes target contents into config.
print_out¶
-
text color
-
Print as soon as possible.
Prints out the given value.
print_plugins¶
Print out enabled plugins.
print_stamp¶
Prints out a stamp containing useful information, such as what and when has generated this configuration.
print_variables¶
Prints out magic variables available in config files alongside with their values and descriptions. May be useful for debugging.
http://uwsgi-docs.readthedocs.io/en/latest/Configuration.html#magic-variables
replace_placeholders¶
Replaces placeholders that can be used e.g. in filepaths.
Supported placeholders: * {project_runtime_dir} * {project_name} * {runtime_dir}
set_fallback¶
- File path or Section to include.
Sets a fallback configuration for section.
Re-exec uWSGI with the specified config when exit code is 1.
set_placeholder¶
Placeholders are custom magic variables defined during configuration time.
Note
These are accessible, like any uWSGI option, in your application code via
.runtime.platform.uwsgi.config.
set_plugins_params¶
-
uWSGI plugins to load
-
Directories to search for uWSGI plugins.
-
Try to automatically load plugins when unknown options are found.
-
Load uWSGI plugins and exit on error.
Sets plugin-related parameters.
set_runtime_dir¶
Sets user-defined runtime directory value.
Classes¶
embedded_plugins_presets¶
These are plugin presets that can be used as embedded_plugins values.
BASIC¶
Basic set of embedded plugins. This set is used in uWSGI package from PyPI.
vars¶
The following variables also known as magic variables could be used as option values where appropriate.
CONF_CURRENT_SECTION¶
The current section identifier, eg. conf.ini:section.
CONF_NAME_ORIGINAL¶
The original conf filename, as specified on the command line