On Sep 7, 2008, at 6:40 PM, Bojan Mihelac wrote:
> > I have try similiar code under both Django dev server and Apache/ > mod_python. Apache did load the result, while Django server did not. > > Is this maybe threading issue? Nope, that's the way the Django development server works – it's single threaded, and only serves one request at a time. If you really need to test your view, you can start another instance on a different port. But from looking at your code, my guess is that you're running unittests on your site, in which case you can use the TestClient: http://docs.djangoproject.com/en/dev/topics/testing/#module-django.test.client Yours, Eric > > > here is samplecode: > > #views.py > from django.http import HttpResponse > from django.core import urlresolvers > import urllib2 > > def test_open_url(request): > host = request.get_host() > test_url = "http://%s/%s" % (host, > urlresolvers.reverse("test_page")) > f = urllib2.urlopen(urllib2.Request(url=test_url)) > html = "<html><body>Loaded page: %s.</body></html>" % f.read() > return HttpResponse(html) > > def test_page(request): > return HttpResponse("test") > > #urls.py > from django.conf.urls.defaults import * > > import views > > urlpatterns = patterns('', > (r'^$', views.test_open_url), > url(r'^test_page$', views.test_page, name = "test_page") > ) > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---