You are responsible for installing the drivers for any databases you want 
to use (with the exception of SQLite, as the Python standard library 
includes its own interface). For PyMongo, see 
http://api.mongodb.com/python/current/installation.html.

Anthony

On Monday, March 20, 2017 at 9:41:33 AM UTC-4, vikas mittal wrote:
>
> Hi All,
>
> I am getting the following issue when I am trying to connect web2py with 
> mongoDB. 
> Can someone help what I am missing and how to make the pymongo driver 
> available on my windows 8.1 on which I am running web2py.
> Sincere Thanks. 
>
>
>
>
> Error ticket for "images"
> Ticket ID
> 127.0.0.1.2017-03-08.16-24-27.5afd0b41-a763-4964-b42b-42d53e6de99a
>
> <type 'exceptions.RuntimeError'> Failure to connect, tried 5 times: 
> Traceback (most recent call last): File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 446, in 
> __init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
> 60, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) 
> File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\mongo.py", 
> line 83, in __init__ self.find_driver(adapter_args) File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
> 192, in find_driver raise RuntimeError("no driver available %s" % 
> str(self.drivers)) RuntimeError: no driver available ('pymongo',)
>
> Version
> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Traceback
>
> Traceback (most recent call last):
>   File "C:\Users\web2py\web2py001\gluon\restricted.py", line 227, in 
> restricted
>     exec ccode in environment
>   File "C:/Users/web2py/web2py001/applications/images/models/db.py", line 
> 1, in <module>
>     db = DAL('mongodb://wuser001:mongodb@localhost:27017/wikiweb')
>   File "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 
> 174, in __call__
>     obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 
> 473, in __init__
>     "Failure to connect, tried %d times:\n%s" % (attempts, tb)
> RuntimeError: Failure to connect, tried 5 times:
> Traceback (most recent call last):
>   File "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\base.py", line 
> 446, in __init__
>     self._adapter = ADAPTERS[self._dbname](**kwargs)
>   File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
> 60, in __call__
>     obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\mongo.py", 
> line 83, in __init__
>     self.find_driver(adapter_args)
>   File 
> "C:\Users\web2py\web2py001\gluon\packages\dal\pydal\adapters\base.py", line 
> 192, in find_driver
>     raise RuntimeError("no driver available %s" % str(self.drivers))
> RuntimeError: no driver available ('pymongo',)
>
> In file: C:\Users\web2py\web2py001\applications\images\models\db.py
>
> db = DAL('mongodb://wuser001:mongodb@localhost:27017/wikiweb')
>
> db.define_table('image',
>                 Field('title', unique=True),
>                 Field('file', 'upload'),
>                 format = '%(title)s')
>
> db.define_table('post',
>                 Field('image_id', 'reference image'),
>                 Field('author'),
>                 Field('email'),
>                 Field('body', 'text'))
>
> db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
> db.post.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s')
> db.post.author.requires = IS_NOT_EMPTY()
> db.post.email.requires = IS_EMAIL()
> db.post.body.requires = IS_NOT_EMPTY()
>
> db.post.image_id.writable = db.post.image_id.readable = False
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to