On Feb 23, 1:20 pm, Kumar McMillan <[email protected]> wrote:
> On Mon, Feb 23, 2009 at 10:57 AM, Chris Curvey <[email protected]> wrote:
>
> > I'm trying to set up a new project with 0.9.7 and Elixir. I followed
> > the steps athttp://cleverdevil.org/computing/68/(I replaced the
> > contents of __init__ with the listed contents), and everything works
> > if I create my tables on my own.
>
> > But, how I can I tell Elixir to create the tables for me? If I go
> > into "paster shell" and try to run create_all(), I get:
>
> > ProgrammingError: (ProgrammingError) (1146, "Table
> > 'mydatabase.mytablel' doesn't exist") 'DESCRIBE `mytable`' {}
>
> > If I try to run "paster setup-app", I get:
>
> > sqlalchemy.exceptions.UnboundExecutionError: The MetaData is not bound
> > to an Engine or Connection. Execution can not proceed without a
> > database to execute against. Either execute with an explicit
> > connection or assign the MetaData's .bind to enable implicit
> > execution.
>
> It seems like you might be using reflection. (Is that the default for
> Elixir? I forget.) I would suggest not calling elixir.setup_all() at
> the module level contrary to the article above. Maybe the code is
> trying to connect to the db before you get to the create_all() part?
>
> I have Elixir working in 0.9.7. Instead of setup_all() in __init__.py
> I have it in load_environment() :
>
> def load_environment(global_conf, app_conf):
> # ...
> # CONFIGURATION OPTIONS HERE (note: all config options will override
> # any Pylons config options)
>
> from sqlalchemy import create_engine
> bind = create_engine(config['sqlalchemy.default.uri'])
> elixir.metadata.bind = bind # probably a better way to do this
> elixir.setup_all()
>
> My websetup.py looks like:
>
> def setup_config(command, filename, section, vars):
> """Place any commands to setup <yourapp> here"""
> conf = appconfig('config:' + filename)
> load_environment(conf.global_conf, conf.local_conf)
>
I put the setup_all in load_environment (in environment.py), and that
seemed to do no harm. But I can't find a method called setup_config
anywhere.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---