Hello~ I need to run the python django project and meanwhile accept the socket connection from somewhere to receive data.
But I dont know is this can be done,so any tips if this is possible? thanks~ kay On 12月27日, 下午4時34分, Vovk Donets <donets.vladi...@gmail.com> wrote: > For what you need this? > Maybe you should consider using Celery for doing background jobs. > > 2011/12/23 Kay <fcapba1...@gmail.com> > > > > > > > > > > > if I have easy asyncore socket code as follow: > > > --------------------------------------------------------------------------- > > ----------------------------------- > > > import socket > > import asyncore > > > class asysocket(asyncore.dispatcher): > > > def __init__(self,host,port): > > asyncore.dispatcher.__init__(self) > > self.create_socket(socket.AF_INET, socket.SOCK_STREAM) > > self.set_reuse_addr() > > self.bind((host, port)) > > self.listen(10) > > print 'server is waiting for socket connection...' > > > def handle_accept(self): > > new,addr = self.accept() > > print 'received from address', addr > > data = new.recv(1024) > > print repr(data) > > > def handle_close(self): > > self.close() > > > server = asysocket('127.0.0.1',1234) > > asyncore.loop() > > > --------------------------------------------------------------------------- > > ------------------------------------- > > > then how to use this in my django project views.py to let it > > automatically work for receiving connection > > > while i start the project as "python manage.py runserver [port]"?? > > > thanks > > -- > *Vovk Donets* > python developer > > skype: suunbeeam > icq: 232490857 > mail: donets.vladi...@gmail.com > www: jetfix.ru -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.