Wander Camilo
Wander Camilo

Reputation: 9

Call python script from html page

I have to make a html page with css and javascript that I have to enter a url in a form. With this url, I have to get some information from the html of the page with a Python 3.2 Script.

I start learning Python some days ago and I have some question:

  1. I need CherryPy/Django to do that? (I'm asking because I executed a script to get the entire html without using CherryPy/Django and it works - no interaction with browser)
  2. CherryPy examples have the html built in the python code. I must write the html in the python script or can I have an html page that call the script with Ajax (or anything else)?
  3. If I can use Ajax, is XmlHttpRequest a good choice?

Thank you! :D

Upvotes: 0

Views: 1136

Answers (1)

Lennart Regebro
Lennart Regebro

Reputation: 172259

  1. No, you don't need a web framework, but in general it's a good idea. Django seems like brutal overkill for this. CherryPy or Pyramid or some micro framework seems better.

  2. You can have an HTML page that calls the CherryPy server, but since this page obviously is a part of the system/service you are building, serving it from the server makes more sense.

  3. Sure, why not.

Upvotes: 1

Related Questions