Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

storing app settings on Google App Engine

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)?

like image 404
hoju Avatar asked Oct 14 '22 08:10

hoju


1 Answers

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.

like image 192
Alex Martelli Avatar answered Nov 04 '22 01:11

Alex Martelli