Home > Blockchain >  How can I run an html page from python using CGI
How can I run an html page from python using CGI

Time:12-28

I am on a project where I have connected python and html using CGI. I am now able to receive inputs from html and save it to MySQL database through python. My project is a ticket booking website. I now have to show the user that their tickets have been booked, and also, I will have to show them their fare. Though I can simply type the code in printing statements to print the data in html, it doesn't look good from the user side, as I can't style it. Has anyone got any solutions? Can I directly start any html page like that?

I tried to print the fare, and I was able to do it. But the page looked very boring without any styling. I want to open an html page from my python file (because I can style it)-, but I am not using any web application like Flask or Django. How can I do it?

CodePudding user response:

To run your Python script as a CGI script, you can either:

  1. Name your script with a .cgi file extension (example.cgi).
  2. Configure Apache to recognize and allow the .py file extension as a CGI script.

CodePudding user response:

To run your Python script as a CGI script, you can either:

Name your script with a .cgi file extension (example.cgi). Configure Apache to recognize and allow the .py file extension as a CGI script.

  • Related