Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay tweets on a page in Django using Tweepy
    primarykey
    data
    text
    <p>I'm new to the Django and Python. I'm trying to create a Django app display on a page a streaming of Tweets from an account filtered by an ash tag (for the moment hardcoded).</p> <p>That s my view.py</p> <pre><code> from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream from django.http import HttpResponse consumer_key="XXXXX" consumer_secret="XXXXX" access_token="XXXXXX" access_token_secret="XXXXX" class StdOutListener(StreamListener): def on_data(self, data): print data return True def on_error(self, status): print status if __name__ == '__main__': l = StdOutListener() auth = OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) stream = Stream(auth, l) stream.filter(track=['BT']) def index(request): return HttpResponse("try") </code></pre> <p>I have obviously my consumer_key, consumer_secret, acess_token and acess_token_secret edited. In my urls.py I have</p> <pre><code> from django.conf.urls import patterns, url from showTweets import views urlpatterns = patterns('', url(r'^$', views.index, name='index') ) </code></pre> <p>And now ok if I go to the index is printing out my "try". But I d like to print out the StdOutListener class thats the one printing my tweets, I'm sure that is working because from terminal I go in that directory running</p> <pre><code> python urls.py </code></pre> <p>it s displaying the tweets streaming on my terminal. But how do I display my streaming on my index page?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload