On May 23, 2012, at 8:40 AM, Anthony wrote:
> If you use the built-in Rocket server in development but another server
> (e.g., Apache, Nginx) on production, you could also do:
>
> if request.env.server_software.startswith('Rocket'):
> con = 'sqlite://...'
> etc.
>
The only real problem with these schemes is that they tend to be
installation-dependent (not a fatal problem, but potentially tricky). You might
be using Rocket for production too, either directly (presumably not a great
idea) or behind mod_proxy, in which case the is_local test would fail as well.
This seems like a case (again) where it'd be nice to be able to drop a line
into a config file to set up the environment in an otherwise
configuration-independent way.
> Anthony
>
> On Wednesday, May 23, 2012 11:14:18 AM UTC-4, rochacbruno wrote:
> if request.is_local():
> con = "sqlite://....."
> else:
> con = "postgres://..."
>
> db = DAL(con)
>
> On Wed, May 23, 2012 at 12:06 PM, Jason Brower <[email protected]> wrote:
> Locally I only want to use SQLite. And on the deployment I want to use
> Postgres.
> Is there a way to make this happen automatically?
> BR,
> Jason Brower
>