GAE (Python) Best practice: Load config from JSON file or Datastore?
Question: I wrote a platform in GAE Python with a Datastore database (using NDB). My
platform allows for a theme to be chosen by the user. Before _every_ page
load, I load in a JSON file (using `urllib.urlopen(FILEPATH).read()`). Should
I instead save the JSON to the Datastore and load it through NDB instead?

Here's an example of my JSON config file. These can range in size but not by
much. They're generally very small.

    
    
    {
        "TITLE": "Test Theme",
        "VERSION": "1.0",
        "AUTHOR": "ThePloki",
        "DESCRIPTION": "A test theme for my platform",
    
        "FONTS": ["Arial", "Times New Roman"],
    
        "TOOLBAR": [
            {"left":[
                {"template":"logo"}
            ]},
            {"center":[
                {"template":"breadcrumbs"}
            ]},
            {"right":[
                {"template":"link", "url":"account", "msg":"Account"},
                {"template":"link", "url":"logout", "msg":"Log Out"}
            ]}
        ],
    
        "NAV_LEFT": true,
        "SHOW_PAGE_TITLE": false
    }
    

I don't currently notice any delays, but I'm working locally. During
production would the `urllib.urlopen().read()` cause problems if there is high
traffic?


Answer: Do you expect the configuration to change without the application code being
re-deployed? That is the scenario where it would make sense to store the
configuration in the Datastore.

If the changing the configuration involves re-deploying the code anyway, a
local file is probably fine - you might even consider making it a Python file
rather than JSON, so that it'd simply be a matter of importing it rather than
messing around with file handles.

