Hi,
I have a "Main Application", and in this application I have the
following in the _init_.py file:
def main(global_config, **settings):
# various config settings
config.include(site_configs)
def site_configs(config):
config.add_route('portfolio', '/portfolio',
view='mainapp.views.portfolio', view_renderer='/site/portfolio.mako')
And in the views.py I have:
def portfolio(request):
## some code here
project_records = dbsession.query(projects).from_statement('SELECT
* FROM projects ORDER by id DESC').all()
return {'project_records': project_records}
And then I have a new application, which I want to extend.
So in the __init__.py I have done:
from mainapp import site_configs
def main(global_config, **settings):
# various config settings
config.include(site_configs)
But when I run this new application, I get the following error (full
traceback at the bottom of this message):
UnboundExecutionError: Could not locate a bind configured on mapper
Mapper|projects|projects, SQL expression or this Session
- The sqlalchemy engine has been properly set up in both
applications.
Also what I want to do is use the database in the new application and
not the one in the original main application.
----------------------------
Full Traceback
----------------------------
URL: http://127.0.0.1:6543/portfolio
Module weberror.evalexception:431 in respond view
>> app_iter = self.application(environ, detect_start_response)
Module repoze.tm:23 in __call__ view
>> result = self.application(environ, save_status_and_headers)
Module pyramid.router:158 in __call__ view
>> response = view_callable(context, request)
Module pyramid.config:2824 in _rendered_view view
>> response = wrapped_view(context, request)
Module pyramid.config:2916 in _requestonly_view view
>> response = view(request)
Module mainapp.views:62 in portfolio view
>> project_records = dbsession.query(projects).from_statement('SELECT * FROM
>> projects ORDER by id DESC').all()
Module sqlalchemy.orm.query:1579 in all view
>> return list(self)
Module sqlalchemy.orm.query:1689 in __iter__ view
>> return self._execute_and_instances(context)
Module sqlalchemy.orm.query:1694 in _execute_and_instances
view
>> mapper=self._mapper_zero_or_none())
Module sqlalchemy.orm.session:717 in execute view
>> engine = self.get_bind(mapper, clause=clause, **kw)
Module sqlalchemy.orm.session:853 in get_bind view
>> ', '.join(context)))
Thanks for reading!
--
You received this message because you are subscribed to the Google Groups
"pylons-devel" 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-devel?hl=en.