2

I've tried following the guide for intergrating mongokit into pylons thats here: http://namlook.github.com/mongokit/pylons.html

When I go to serve with paster it throws the error:

File "/home/ciferkey/Projects/runnr-site/runnrsite/config/environment.py", line 29, in load_environment
config['pylons.app_globals'] = app_globals.Globals(config)
TypeError: __init__() takes exactly 1 argument (2 given)

if I throw a dummy parameter into the init for Globals:

def __init__(self, foo):

then it no longer throw the error but instead throws:

File "/usr/lib/pymodules/python2.6/pylons/configuration.py", line 141, in __getitem__
return dict.__getitem__(self, name)
KeyError: 'db_host'

Now this is referencing the lines in lib/app_globals.py that the guide tells you to put in:

self.connection = Connection(
      host = config['db_host'],
      port = int(config['db_port']),
    )

and i understand that I'm to replace db_host and db_port with the actual information, but no matter what I try it throws the same error. Any ideas as to why this is happening?

ciferkey
  • 2,064
  • 3
  • 20
  • 28

1 Answers1

0

Have you tried Mongoengine? I'm currently using it for my own Pylons project and found it very easy to setup and use. http://www.cleverkoala.com/2010/09/how-to-integrate-mongoengine-into-pylons/

Brian Cajes
  • 3,274
  • 3
  • 21
  • 22
  • I have but unfortunately I have another piece of software that creates the data in mongodb which I am having the site display and that already uses mongokit. However I was able to get monogkit working with Christian Joudrey's tip and some finessing of my own. – ciferkey Jan 18 '11 at 22:12