Jimmy, Not sure what JavaScript library you use (or if you're familiar with JavaScript at all), but this is a very rudimentary example:
First, create a View in Django that you can call, and capture the results: import os > from django.http import HttpResponse > ... > def ajax(req): > if req.is_ajax(): > stdout = os.popen("script_you_want_to_run.py") > output = stdout.read() > return HttpResponse(output) Make sure you can call it by adding it in your urls.py (be sure that it's defined *above* any other line that may redirect you somewhere else): urlpatterns = patterns('', > url(r'^ajax', 'your_project.your_app.views.ajax'), ... ) Then call it from whatever template you're wanting to use (I'm going to use Dojo for this example, just because it's my favorite JavaScript library): var resultDisplay = dojo.byId("results"); // whatever element you want to > display your results > dojo.xhrGet({ > url: '/ajax', // this accesses the view you created earlier > load: function(data) { > resultDisplay.innerHTML = data; // 'data' should be the output > that you returned from the view > } > }); Again, this is very basic, but this should get you started. Use some test scenarios to try it out just so you get the idea (such as dropping in a Python script that does nothing but output "Hello"). I hope this helped. -- Joey "JoeLinux" Espinosa* * <http://joelinux117.blogspot.com> <http://twitter.com/joelinux117><http://about.me/joelinux> On Sat, Nov 12, 2011 at 6:43 AM, jc <jimmy.case...@gmail.com> wrote: > Oh, that would *totally* be fine. I have no idea how to do that, do you > know of any docs that might show me how to execute this code on the > server-side and print out via AJAX? > > thanks! > jimmy > > -- > 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/-/KnKT8mJOggUJ. > > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.