views:

51

answers:

2

Coming from a java background I'm used to having a bunch of properties files I can swap round at runtime dependent on what server I'm running on e.g. dev/production.

Is there a method in python to do similar, specifically on Google's App Engine framework?

At the minute I have them defined in .py files, obviously I'd like a better separation.

+1  A: 

You can:

  1. edit records in the datastore through the dashboard ( if you really have to )

  2. upload new scripts / files ( you can access files in READ-ONLY )

  3. export a WEB Service API to configuration records in the datastore ( probably not what you had in mind )

  4. access a page somewhere through an HTTP end-point

jldupont
how do I access files as read-only on app engine?
rutherford
through the usual Python file I/O: use relative paths of course e.g. get current directory.
jldupont
is that guaranteed to work in a distributed environment such as app engine?
rutherford
yes - I've been using this technique from day1 on my site.
jldupont
+1  A: 

I don't see what is wrong with using python files to configure your application (apart from cultural issues :) ). In fact I have an issue with frameworks which don't allow me to script the configuration parameters.

That said, please have a look http://aaron.oirt.rutgers.edu/myapp/docs/W1100_2300.GAEDeploy for a discussion of how to configure WHIFF application resources to configure applications to work in and out of the GAE framework in a portable manner.

Aaron Watters
I guess it is a culture thing. Just the fact that a .py file can do more, whereas .properties is somewhat foolproof (I like foolproof)
rutherford
I don't think .properties files are foolproof (I must be a bigger fool than you).
Aaron Watters
If you want a powerful analogue to .properties for loading data into Python you could use files in JSON format... I still like to be able to do things like "for" loops and math computations in my configuration file however.
Aaron Watters