How do you setup a settings file? One is for your local development server and another set of setting values for when you upload to Google App Engine?
For example, I would like to set up a settings file where I store the Absolute Root URL.
It's not clear from your question if you're asking about the Java or Python runtime. I'll assume Python for now.
Just like any other Python webapp, the settings file can be wherever and whatever you want. I usually use a .py file called 'settings.py' or 'config.py' in the root directory of my app. For example, see Bloog's settings file.
As far as having different settings for production and development goes, you have two options:
Autodetect which platform you're running on, and apply settings as appropriate. The easiest way to do this is to check the value of os.environ['SERVER_SOFTWARE'], which will start with 'Dev' if it's the development server. You can use this to set a flag like so:
DEBUG = os.environ['SERVER_SOFTWARE'].startswith('Dev')
You can find out the root URL from the request, and use that instead of configuring it manually. Or if you need further configuration, then use that to decide which config to use.
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