Best Way to launch an asynchronous function in django?
<p>I am using <code>tweepy</code> library to collect tweets from <code>twitter streaming API</code> and store them in an <code>Elasticsearch</code> server. Overall I am writing a simple <code>Django application</code> to display the tweets in real time, over a map. However for that I need the ElasticSearch database to be populated in realtime, constantly by the Django Server i.e it should preferably start doing it as soon as the Django Server is launched. What will be a good way to go about it ?</p>

<p>The calls look as followin:</p>

<pre><code>streamer = tweepy.Stream(twitter_api.auth, listener=stream_listener)
streamer.filter(locations=[-180, -90, 180, 90], languages=['en'], async=True)
</code></pre>

<p>I use supervisor + <a href="https://docs.djangoproject.com/es/1.10/howto/custom-management-commands/" rel="nofollow">custom django command</a>. Inside the command you decide when to run that asynchronous function.</p>

python django twitter django-views tweepy