【问题标题】:How can I run an html page from python using CGIHow can I run an html page from python using CGI
【发布时间】:2022-12-27 22:17:40
【问题描述】:

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?

【问题讨论】:

    标签: python html cgi


    【解决方案1】:

    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.

    【讨论】:

      猜你喜欢
      • 2022-12-27
      • 2022-12-01
      • 2022-12-26
      • 2022-12-27
      • 2022-12-01
      • 2022-12-27
      • 2022-12-19
      • 2022-12-02
      • 2022-12-02
      相关资源
      最近更新 更多