Friday, July 1, 2011

Re: JQuery .load() works in production but fails in development

Hi Folks:

I figured it out. The idea is NOT to use CGI. It is not needed. Simply use a Django WSGI URL to access the python module (in a view) and everything it works fine. It as blindingly obvious once I figured it out.

Here is what I did to get it to work:
  1. Added a new URL called '/status/sync' in urls.py: url(r'^sync/status/$','status'),
  2. Added status to my views.py:
    from django.http import HttpResponse
    import datetime
    def sync_status(request):
        now = datetime.datetime.now()
        html = 'now = %s' % (now)
        return HttpResponse(html)
  3. Changed my index.html javascript as follows:
        $('#status').load('/employees/sync/status');
And everything worked perfectly in both environments. I have now removed the CGI stuff.

Sorry to have bothered you.

Regards,

Joe



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/nSUGnywpdngJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment