Class: QgsServerSettings¶
Provides a way to retrieve settings by prioritizing according to environment variables, ini file and default values.
- class qgis.server.QgsServerSettings[source]¶
Bases:
object- __init__()
Constructor.
- __init__(a0: QgsServerSettings)
- Parameters:
a0 (QgsServerSettings)
- allowedExtraSqlTokens(self) List[str][source]¶
Returns the list of strings that represent the allowed extra SQL tokens accepted as components of a feature filter. The default value is an empty string, the value can be changed by setting the environment variable QGIS_SERVER_ALLOWED_EXTRA_SQL_TOKENS.
Added in version 3.28.
- Return type:
List[str]
- apiResourcesDirectory(self) str[source]¶
Returns the server-wide base directory where HTML templates and static assets (e.g. images, js and css files) are searched for.
The default path is calculated by joining
QgsApplication.pkgDataPath()with “resources/server/api”, this path can be changed by setting the environment variable QGIS_SERVER_API_RESOURCES_DIRECTORY.Added in version 3.10.
- Return type:
str
- apiWfs3MaxLimit(self) int[source]¶
Returns the server-wide maximum allowed value for "limit" in a features request.
The default value is 10000, this value can be changed by setting the environment variable QGIS_SERVER_API_WFS3_MAX_LIMIT.
Added in version 3.10.
- Return type:
int
- apiWfs3RootPath(self) str[source]¶
Returns the server-wide root path for OAPIF (WFS3) service API.
The default value is “/wfs3”, this value can be changed by setting the environment variable QGIS_SERVER_API_WFS3_ROOT_PATH.
Note
The default will be changed to “/ogcapi” for QGIS 4.
Added in version 3.44.3.
- Return type:
str
- applicationName(self) str[source]¶
Returns the QGIS Server application name. The default value is the concatenation of
QgsApplication.applicationName()andQgsApplication.platform()separated by a space, the value can be changed by setting the environment variable QGIS_SERVER_APPLICATION_NAME.Added in version 3.30.
- Return type:
str
- cacheDirectory(self) str[source]¶
Returns the cache directory.
- Return type:
str
- Returns:
the directory.
- capabilitiesCacheSize(self) int[source]¶
Returns the maximum number of project capabilities to cache. The default value is 40 and the value can be changed by setting the environment variable QGIS_SERVER_CAPABILITIES_CACHE_SIZE.
Added in version 3.31.
- Return type:
int
- forceReadOnlyLayers(self) bool[source]¶
Returns
Trueif the reading flag force layer read only is activated.The default value is
False, this value can be changed by setting the environment variable QGIS_SERVER_FORCE_READONLY_LAYERS.Added in version 3.28.
- Return type:
bool
- getPrintDisabled(self) bool[source]¶
Returns
Trueif WMS GetPrint request is disabled and the project’s reading flagQgsProject.ReadFlag.FlagDontLoadLayouts is activated.The default value is
False, this value can be changed by setting the environment variable QGIS_SERVER_DISABLE_GETPRINT.Added in version 3.16.
- Return type:
bool
- ignoreBadLayers(self) bool[source]¶
Returns
Trueif the bad layers are ignored andFalsewhen the presence of a bad layers invalidates the whole project making it unavailable.The default value is
True, this value can be changed by setting the environment variable QGIS_SERVER_IGNORE_BAD_LAYERS.Added in version 3.10.5.
- Return type:
bool
- ignoreRenderingErrors(self) bool[source]¶
Returns
Trueif rendering errors are ignored by the server. ReturnsFalseif the server throws an error in case of rendering errors.Added in version 4.0.
- Return type:
bool
- iniFile(self) str[source]¶
Returns the ini file loaded by QSetting.
- Return type:
str
- Returns:
the path of the ini file or an empty string if none is loaded.
- landingPageBaseUrlPrefix(self) str[source]¶
Returns the landing page base URL regular expression, defaults to /.
Added in version 3.20.
- Return type:
str
- landingPageProjectsDirectories(self) str[source]¶
Returns the directories used by the landing page service to find .qgs and .qgz projects. Multiple directories can be specified by separating them with ‘||’.
Added in version 3.16.
- Return type:
str
- landingPageProjectsPgConnections(self) str[source]¶
Returns the PostgreSQL connection strings used by the landing page service to find projects. Multiple connections can be specified by separating them with ‘||’.
Added in version 3.16.
- Return type:
str
- load(self)[source]¶
Load settings according to current environment variables.
load(self, envVarName: Optional[str]) -> bool Load setting for a specific environment variable name.
- Returns:
Trueif loading is successful,Falsein case of an invalid name.
- logFile(self) str[source]¶
Returns the log file.
- Return type:
str
- Returns:
the path of the log file or an empty string if none is defined.
- logLevel(self) Qgis.MessageLevel[source]¶
Returns the log level.
- Return type:
- Returns:
the log level.
- logProfile(self) bool[source]¶
Returns
Trueif profile information has to be added to the logs, default value isFalse.Note
this flag is only effective when
logLevel()returnsQgis.MessageLevel.Info (0)See also
Added in version 3.18.
- Return type:
bool
- logStderr(self) bool[source]¶
Returns whether logging to stderr is activated.
- Return type:
bool
- Returns:
Trueif logging to stderr is activated,Falseotherwise.
Added in version 3.4.
- maxThreads(self) int[source]¶
Returns the maximum number of threads to use.
- Return type:
int
- Returns:
the number of threads.
- static name(env: QgsServerSettingsEnv.EnvVar) str[source]¶
Returns the string representation of a setting.
Added in version 3.16.
- Parameters:
- Return type:
str
- overrideSystemLocale(self) str[source]¶
Overrides system locale
- Return type:
str
- Returns:
the optional override for system locale.
Added in version 3.8.
- parallelRendering(self) bool[source]¶
Returns parallel rendering setting.
- Return type:
bool
- Returns:
Trueif parallel rendering is activated,Falseotherwise.
- projectCacheCheckInterval(self) int[source]¶
Returns the config cache check interval (in ms) for the ‘periodic’ strategy.
Added in version 3.26.
- Return type:
int
- projectCacheSize(self) int[source]¶
Returns the projects cache size The default value is 100, the value can be changed by setting the environment variable QGIS_SERVER_PROJECT_CACHE_SIZE.
Added in version 3.44.
- Return type:
int
- projectCacheStrategy(self) str[source]¶
Returns the project’s cache strategy The default value is ‘filesystem’, the value can be changed by setting the environment variable QGIS_SERVER_PROJECT_CACHE_STRATEGY. Possible values are:
‘filesystem’: Use file system watcher for notifying projects change. Note that it works only with projects stored in files and not across mounted NFS volumes on Linux.
‘periodic’: Timer based periodic check for project’s changes. Works with all storage backend.
‘off’: Disable completely internal project’s cache handling
Added in version 3.26.
- Return type:
str
- projectFile(self) str[source]¶
Returns the QGS project file to use.
- Return type:
str
- Returns:
the path of the QGS project or an empty string if none is defined.
- retryBadLayers(self) bool[source]¶
Returns
Trueif bad layers should be re-checked after the project has been cached. The default value isFalseAdded in version 4.0.
- Return type:
bool
- serviceUrl(self, service: str | None) str[source]¶
Returns the service URL from the setting.
Added in version 3.20.
- Parameters:
service (Optional[str])
- Return type:
str
- showGroupSeparator(self) bool[source]¶
Show group (thousand) separator
- Return type:
bool
- Returns:
if group separator must be shown, default to
False.
Added in version 3.8.
- trustLayerMetadata(self) bool[source]¶
Returns
Trueif the reading flag trust layer metadata is activated.The default value is
False, this value can be changed by setting the environment variable QGIS_SERVER_TRUST_LAYER_METADATA.Added in version 3.16.
- Return type:
bool