EsmeraldSettings
class¶
Reference for the EsmeraldSettings
class object and how to use it.
Read more about how to use the settings in your application and leverage the system.
The settings are used by any Esmerald application and used as the defaults for the Esmerald class instance if nothing is provided.
How to import¶
from esmerald import settings
Via conf
from esmerald.conf import settings
Via application instance
from esmerald import Esmerald
app = Esmerald()
app.settings
esmerald.EsmeraldSettings
module-attribute
¶
EsmeraldSettings = EsmeraldSettings
EsmeraldSettings
settings object. The main entry-point for any settings
used by any Esmerald application.
Usually, when creating an application you will need some sort of organisation and some sort of settings. Esmerald comes with a native settings system where you will only need to inherit, override and add your own extra settings and use them anywhere.
When no values are provided upon an instantiation of an Esmerald
object, these
settings are used as the defaults.
The settings can be done via ESMERALD_SETTINGS_MODULE
or settings_module
parameter
in the Esmerald instantiation.
Learn more about settings.
Tip
The settings system is extremely powerful and must be leveraged accordingly. Read more about how to use the settings and how you can take advantage of the system.
Example
from esmerald import EsmeraldSettings
from esmerald.conf.enums import EnvironmentType
class AppSettings(EsmeraldSettings):
'''
Create your own custom settings.
'''
debug: bool = False
environment: Optional[str] = EnvironmentType.TESTING