I can connect to my database in __init__.py, but connecting to the database 
in a view function times out. I'm using the DataStax python driver. I get 
the same result if I create the connection somewhere else and import it, so 
I really doubt it's caused by a timeout due to initialising the connection.

about to create client
SimpleClient created
Traceback (most recent call last):
  File 
"/home/taylor/projects/tacle/env34/lib/python3.4/site-packages/pyramid-1.5-py3.4.egg/pyramid/router.py",
 
line 242, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File 
"/home/taylor/projects/tacle/env34/lib/python3.4/site-packages/pyramid-1.5-py3.4.egg/pyramid/router.py",
 
line 217, in invoke_subrequest
    response = handle_request(request)
  File 
"/home/taylor/projects/tacle/env34/lib/python3.4/site-packages/pyramid-1.5-py3.4.egg/pyramid/tweens.py",
 
line 21, in excview_tween
    response = handler(request)
  File 
"/home/taylor/projects/tacle/env34/lib/python3.4/site-packages/pyramid-1.5-py3.4.egg/pyramid/router.py",
 
line 163, in handle_request
    response = view_callable(context, request)
  File 
"/home/taylor/projects/tacle/env34/lib/python3.4/site-packages/pyramid-1.5-py3.4.egg/pyramid/config/views.py",
 
line 355, in rendered_view
    result = view(context, request)
  File 
"/home/taylor/projects/tacle/env34/lib/python3.4/site-packages/pyramid-1.5-py3.4.egg/pyramid/config/views.py",
 
line 501, in _requestonly_view
    response = view(request)
  File "./tacle/event_views.py", line 63, in event_list
    caclient.connect(['127.0.0.1'])
  File "./cassaconn/clients.py", line 22, in connect
    self.session = cluster.connect()
  File 
"/home/taylor/projects/tacle/env34/lib/python3.4/site-packages/cassandra/cluster.py",
 
line 546, in connect
    self.control_connection.connect()
  File 
"/home/taylor/projects/tacle/env34/lib/python3.4/site-packages/cassandra/cluster.py",
 
line 1498, in connect
    self._set_new_connection(self._reconnect_internal())
  File 
"/home/taylor/projects/tacle/env34/lib/python3.4/site-packages/cassandra/cluster.py",
 
line 1533, in _reconnect_internal
    raise NoHostAvailable("Unable to connect to any servers", errors)
cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', 
{'127.0.0.1': OperationTimedOut('errors=Timed out creating connection, 
last_host=None',)})
[pid: 2130|app: 0|req: 2/2] 127.0.0.1 () {38 vars in 641 bytes} [Fri Jun  6 
21:47:43 2014] GET /event_list => generated 0 bytes in 5007 msecs (HTTP/1.1 
500) 0 headers in 0 bytes (0 switches on core 0)


And the view code:

@view_config(route_name="event_list", 
renderer="templates/events/list_events.jinja2")
def event_list(request):
    tacs = {}
    print('about to create client')
    caclient = SimpleClient()
    caclient.connect(['127.0.0.1'])
    print('able to connect to cassandra server')
    #caclient.catest()
    print("---------page reload-----------")

    return dict(resource=request.context, tacs=tacs)

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to