Django / Flask implementation: constantly listening on a connection through HTTP or Socket. (in the background)

I am currently planning a web application that requires constant listening to an open socket connection and writing certain things to the database.

To get to know flask (the framework of my choice) and python in general, I want to play with twitter-streaming-api.

The main problem is the same. How to implement a permanent "Connection-Listener" for both types of connections?

Is the method below suggested the best way to do this?

Streaming API Integration with Django

For some reason, I don’t like the idea of ​​introducing a system daemon on a machine.

Change: Of course, I want to serve users through HTTP. All this should be non-blocking.

+5
source share
2 answers

If you want the system to be non-blocking, neither Flask nor Django will provide the support you are looking for. You should probably check out Twisted from the most mature python project for non-blocking IO: http://twistedmatrix.com/trac/

API . "" webapp, Django, , - Twisted-Flask ( , ). , , Django Twisted : http://dreid.org/2009/03/twisted-django-it-wont-burn-down-your.html/

: ;)

+5

Eventlet .

python twit api: twisted tornado.

+2

All Articles