I need to store settings for my Google App Engine project. Currently I have:
class Settings(db.Model):
rate = db.IntegerProperty(default=4)
...
And when I want to use it:
Settings.get_or_insert('settings')
This feels clumsy so is there a better way (without using Django)?
Please clarify what does "feel clumsy" to you about this -- that's not very clear to me.
The datastore is the way to persist updatable data in App Engine (blobstore's for huge blobs, memcache's not guaranteed persistent). If your settings can't be changed by the application of course you can just put them in your own custom .yaml
file (or whatever, but yaml's how App Engine's own configuration files are already stored anyway...;-); just remember all such files are read-only from the application's viewpoint. YAML is conveniently available to App Engine apps for parsing their own .yaml
(but "read-only") files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With