python - Integrating SimpleWebSocketServer with django and apache -
I use Apache with django and mod_wsgi.
I'm trying this module: Actually I'm trying to integrate the websocket with my Denggo app, so I can share variables and can query DB with both servers.
This is my code using my library:
myserver.py :
I use the thread
then it does not block the rest of the code.
If I run this code alone, and creates a web site in the browser:
javascript :
var sockets; Function currentset () {socket = new web site ("ws: // localhost: 8001"); Socket.onopen = function (evt) {test.inner html = "connected \ n";}; Socket.onclose = function (evt) {test.innerHTML + = "Disconnected \ n"}; Socket.onmessage = function (evt) {warning (evt.data);}; Socket.error = function (evt) {warning ("error");}; } StartSocket ();
Everything is working well The problem is how to integrate it into my DNS code. So I put the __ init __.py
file in my project file myserver.py
. I have created a setting WEB_SOCKET, for which I assign the SimpleWebSocket
example. This creates an object (I have checked in debug mode), but still - no events, no connection, nothing. this does not work. Why?
And maybe there is another solution to this problem? I need something simple and simple like this module, and it should be able to integrate it with the demo.
You need to add the location of your project in Python Path so that you os the location of your project settings Can be set in .environ and do this.
Comments
Post a Comment