jtd/sendmsg/views.py

18 lines
433 B
Python

# 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)