This package provies a straightforward way to store and access environment-specific and secret/private variables in the Google App Engine Datastore.
## Quick start
Install `gae_app_settings`:
```bash
$ pip install gae_app_settings
```
In your settings module or some other module that loads at startup:
```python
from gae_app_settings import AppSetting
value = AppSetting.get('MY_SETTING_KEY', DEFAULT_VALUE)
```
## Full documentation
AppSetting is a class that is used to persist/store sensitive values in your environment. It is designed to work just like a dictionary, but it is limited to just string values.
Settings cannot be set programmatically, they are only retrievable:
```python
value = AppSetting.get('MY_SETTING_KEY', DEFAULT_VALUE)
```
**NOTE:** regardless of the type of `DEFAULT_VALUE `, `value` will always be a string. This is to ensure that the return value is of the same type whether the setting is set or unset, as a set value will be a string.
You can also retrieve values without passing a default:
```python
value = AppSetting.get('MY_SETTING_KEY')
```
**Note:** If no default value is provided and the key has not been given a value in the datastore, the `get()` call will raise a `KeyError` and a placeholder entry will be created in the datastore. Once the placeholder has been replaced with a value future calls to `get()` will succeed.
## Best practices
The following best practices are recommended:
1. Settings should be loaded at program start and stored locally in a `settings.py` or similar module
1. Default values should be provided for every setting:
1. these should be the values that make sense when running/testing locally
1. placeholders will be inserted into the Datastore, and these only need to be overwritten if there are environment-specific settings that need to be set (in production, all values should be set)
1. Do not change the type of the `value` property in the datastore; coersion should happen on the result of the call to `get()`
Metadata
Release files for gae-app-settings 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gae-app-settings-1.1.1.tar.gz | 4.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gae_app_settings-1.1.1-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 9.3 kB
Release files / gae-app-settings-1.1.1.tar.gz
| Download URL | gae-app-settings-1.1.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f78b6c7d485ab55dccb5df4ac749079e3887614ab0e14677e129e1f0d8b68e27
|
|
BLAKE2b-256 checksum How to use checksums |
7eff549088bd19f0932e73ede808db63bd9c71052968f0fc589bb0a497b08d92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15
|
Release files / gae_app_settings-1.1.1-py2-none-any.whl
| Download URL | gae_app_settings-1.1.1-py2-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
4c98c2d1eefc685193c61b016aa123e4516d24dd4d7ea39c4161bdf7ce953863
|
|
BLAKE2b-256 checksum How to use checksums |
9cf109c2ee55400670f5a04cb14739582502aa3d6dd569c09cc9ae9b6b5e9b8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15
|
Security for gae-app-settings 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.