1

I know that you can have PHP -code inside HTML -file. I would like to know how you can do the same with Python.

How can you run Python inside a HTML document?

4 Answers4

6

Cheetah

Cheetah is a Python-powered template engine and code generator. It may be used as a standalone utility or combined with other tools. Cheetah has many potential uses, but web developers looking for a viable alternative to ASP, JSP, PHP and PSP are expected to be its principle user group.

Charles Roper
  • 10,879
3

Look at django templating engine for example. django

3

You will need something like mod_python for apache, or play with cgi.

It really depends on your web server

0

Use Mako or Jinja2. Both are very fast, and best at doing their job. You should not create SQL queries in your template, but in your controller logic. Later, pass variables/functions to a template and output them.

iElectric
  • 459