jtd/sendmsg/views.py

18 lines
433 B
Python
Raw Permalink Normal View History

2011-07-05 11:03:02 +00:00
# Create your views here.
from django.http import HttpResponse
import socket
from django.shortcuts import render_to_response
def sendMsg(request):
msg = request.GET.get("msg", "")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 4321))
s.send(msg)
return HttpResponse("ok")
def index(request):
d = {
'foo': 'jtd'
}
return render_to_response("index.html", d)