Excuse my ignorance
how does this then interact with meta.create from sqlalchemy? This is
what I am aiming at:
# in websetup.py
def setup_config(command, filename, section, vars):
app_conf = paste.deploy.appconfig('config:' + filename)
paste.deploy.CONFIG.push_process_config({'app_conf':app_conf.local_conf,
'global_conf':app_conf.global_conf})
if raw_input("Create databasere? [Y/n]").lower() in ['y','']:
try:
dburi = app_conf.get('sqlalchemy.dburi', None)
if not dburi:
raise ValueError, "Could not find 'sqlalchemy.dburi'
in config file=%s" % filename
print "Connecting to DSN %s..."%repr(dburi)
I would like the setup_config to ask if I would like to setup up a
particular database for use depending on the app, this allows me to
have one pool of models in my models.py for all my apps, and I can
choose which types of tables are to be created when I deploy the app
thanks
On Jun 8, 7:48 am, "Shannon -jj Behrens" <[EMAIL PROTECTED]> wrote:
> On 6/7/07, voltron <[EMAIL PROTECTED]> wrote:
>
> > I have meta.create_all() in my websetup.py file, this takes all the
> > models in the models.py file and attempts to create a database based
> > on the models found, can one code a conditional that asks beforehand
> > exactly what databases it should create create? All I have are prints
> > in my websetup but I dont know how to interact with meta.
>
> If all else fails, you can always use the environment:
>
> env SETUP_USER_DATABASE=1 SETUP_OTHER_DATABASE=0 paster setup-app foo.ini
>
> In your websetup.py:
>
> import os
>
> ...
> if int(os.getenv('SETUP_USER_DATABASE', 0)):
> self.setup_user_database()
> ...
>
> Best Regards,
> -jj
>
> --http://jjinux.blogspot.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---