J..
-
Posts
4 -
Joined
-
Last visited
Posts posted by J..
-
-
Okay, sorry to bother you again, but urllib2.urlopen doesn't seem to be working in Django. If I put the following script in cgi-bin:
#!/usr/bin/python print "Content-type:text/html\n" from urllib2 import urlopen, URLError out = "" try: urlopen("http://google.com") except URLError, e: print "<p>"+str(e.reason)+"</p>" print "<p>done</p>"
The output is '<p>done</p>'. But if I use this in Django (views.py):
from django.shortcuts import HttpResponse from urllib2 import urlopen, URLError def sample (request): out = "" try: urlopen("http://google.com") except URLError, e: out += "<p>"+str(e.reason)+"</p>" out += "<p>done</p>" return HttpResponse(out)
The output is '<p>unable to select on socket</p><p>done</p>'.
Is there any reason this might be happening? These are located here and here respectively
-
Yeah, it's working great. Thanks.
-
I've followed the instructions here, but I just see the dispatch.wsgi file's source code, even though its permissions are set to 755. The project is just something simple to see if I could get it to work, and it runs fine locally. Have I done something wrong?
Can't get Django to work
in Questions
Posted
It's definitely there, it's just not working right through Django. Thanks anyway; I'll see what I can find out.
Wait, what do you mean, 'try installing SnakeCharmer'? What is it, and why would it help?