Closed Codeinator-0711 closed 3 years ago
Get startet with: https://flask.palletsprojects.com/
Hey coding people,
I did some research about web servers in Python and found this Youtube video:
https://www.youtube.com/watch?v=hFNZ6kdBgO0
This code sets up a web server on local port 8080:
from http.server import HTTPServer, BaseHTTPRequestHandler
class Serv(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/':
self.path = '/index.html'
try:
file_to_open = open(self.path[1:]).read()
self.send_response(200)
except:
file_to_open = "File not found"
self.send_response(404)
self.end_headers()
self.wfile.write(bytes(file_to_open, 'utf-8'))
httpd = HTTPServer(('localhost', 8080), Serv) httpd.serve_forever()
This html file contains the text that is being displayed on the web server:
<!DOCTYPE html>
For this research, I would say we definitely need the http.server module for our project. It's just a first try, but I'm looking forward to your comments!
How do we start a web server that opens a web page in the default browser that provides the following features:
A nice logo and layout. Use the HSD logo or create your own. A Google-like search field at the top with a search button to update the visualization. The field should be prefilled with the current location. Pressing the search button will read the location from the search field and refresh the page. Below the search field a screen-filling map is shown with the selected location in the center, and a zoom-in factor appropriate to cover a circle with actual search radius. On overlay that draws the location of all earthquakes of the last 24 hours into the actual map, represented by a circle contains the strength (Richter scala) of the earth quake and a label with the timestamp of the earth quake. the web page should be update evers