So I am currently trying to get python to output html on a webpage. Its not working, as there is nothing on the screen, and not sure why. Running the server like so:
from http.server import HTTPServer, CGIHTTPRequestHandler
port = 8080
httpd = HTTPServer(('', port), CGIHTTPRequestHandler)
print("Starting simple_httpd on port: " + str(httpd.server_port))
httpd.serve_forever()
My simple file, which is just to test and make sure I can accomplish this the way I am trying to. I am receiving this form a form that has one input for an email:
#! /usr/local/bin/python3
#This file is used for testing to make sure output to browser is as expected
import cgi
form_data = cgi.FieldStorage()
email = form_data['email'].value
print("<!doctype html> <br />")
print("<html> <head></head><body>")
print("<p>This is the email info: " + email+</p>)
print("</body>")
print("<html>")
I am new to python, and essentially just trying to print this out. I have searched and have yet to find an answer. So I am hoping the distinguished minds of stack overflow can help me out. I don't want a framework, just to be able to print out few things, but not sure why its not working.
</p>should be in quotes. If that's not just a copy-paste error, it could be that the server is catching that error somewhere along the way and just not showing anything. Also, if you view source in your browser, is there anything there?