fanout / django-eventstream

Server-Sent Events for Django
MIT License
650 stars 85 forks source link

AttributeError: 'NoneType' object has no attribute 'get_current_id' #15

Closed vnahmias closed 6 years ago

vnahmias commented 6 years ago

hello i have the following error : AttributeError: 'NoneType' object has no attribute 'get_current_id' here are the logs :

Traceback (most recent call last):
  File "/home/vincentnahmias/Workspace/venvs/testbed/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/vincentnahmias/Workspace/venvs/testbed/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/vincentnahmias/Workspace/venvs/testbed/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/vincentnahmias/Workspace/IOT-Testbed-Dashboard/Dashboard/views.py", line 13, in home
    context['last_id'] = get_current_event_id(['test'])
  File "/home/vincentnahmias/Workspace/venvs/testbed/lib/python3.6/site-packages/django_eventstream/eventstream.py", line 108, in get_current_event_id
    cur_ids[channel] = str(storage.get_current_id(channel))
AttributeError: 'NoneType' object has no attribute 'get_current_id'

i just copy past the fuction in views.py in your project into mine so i don't really know what's the cause.

jkarneges commented 6 years ago

Ah, you need to enable storage: https://github.com/fanout/django-eventstream#event-storage

Will see about improving the error message so this is more clear.

vnahmias commented 6 years ago

OH great thank you !

jkarneges commented 6 years ago

Fixed in master.