Exemple #1
0
 def iterator(self):
     if settings.TESTING:
         #
         # When testing, with current Django (1.5.1) the LiveServerTestCase
         # servers only one thread for the server. So, if we listen for
         # Redis messages, we block the only socket of the test server. So,
         # to be able to test Javascript in web browsers (EventSource
         # support) we just fake incoming messages. Yes, this does not
         # test our Redis communication properly. On the other hand,
         # I rather leave Redis communication w/o testing, because
         # that's job of django-sse package - and focus on testing
         # browsers with EventSource support.
         #
         for message in testutil.MESSAGES:
             self.sse.add_message("message", message)
         testutil.MESSAGES = []
         return [1]
     return RedisQueueView.iterator(self)
Exemple #2
0
from django.conf.urls import patterns, url
from django_sse.redisqueue import RedisQueueView

urlpatterns = patterns(
    '',
    url(r'^$', 'tweet_count.views.index', name='index'),
    url(r'^api/1/count$', 'tweet_count.views.count', name='count'),
    url(r'^api/1/control$', 'tweet_count.views.control', name='control'),
    url(r'^api/1/stream$', RedisQueueView.as_view(), name="stream"),
)
from .apiauth import ObtainAuthToken, ObtainLogout, ObtainUser

admin.autodiscover()


urlpatterns = patterns('',
                       url(r'^admin/', include(admin.site.urls)),
                       url(r'^admin_tools/', include('admin_tools.urls')),
                       url(r'^api-auth/', include(
                           'rest_framework.urls', namespace='rest_framework')),

                       url(r'^api-token/login/(?P<backend>[^/]+)/$',
                           ObtainAuthToken.as_view()),
                       url(r'^api-token/user/', ObtainUser.as_view()),
                       url(r'^api-token/logout/', ObtainLogout.as_view()),

                       url(r'^tweets/', include('tweets.urls')),


                       url(r'^experiments$', TemplateView.as_view(
                           template_name='experiments.html'),
                       name='experiments'),
                       url(r'^stream/$', RedisQueueView.as_view(
                           redis_channel="stream"),
                           name='stream'),
                       url(r'^$', MainHomePage.as_view(), name='home'),
                       )


urlpatterns += staticfiles_urlpatterns()
Exemple #4
0
from django.conf.urls import patterns, include, url

from .web.views import *
from django_sse.redisqueue import RedisQueueView

urlpatterns = patterns('',
    url(r'^home1/$', Home1.as_view(), name='home1'),
    url(r'^home2/$', Home2.as_view(), name='home2'),

    url(r'^events1/$', MySseEvents.as_view(), name='events1'),
    url(r'^events2/$', RedisQueueView.as_view(), name='events2'),
)