diff --git a/webserver.py b/webserver.py index e44a5b3f5c..ab19863de5 100644 --- a/webserver.py +++ b/webserver.py @@ -1,3 +1,7 @@ +from sqlalchemy import create_engine +from sqlalchemy.orm import sessionmaker +from database_setup import Base, Restaurant + from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import cgi @@ -9,49 +13,32 @@ class webserverHanlder (BaseHTTPRequestHandler): def do_GET(self): try: - if self.path.endswith("/hello"): + engine = create_engine('sqlite:///restaurantmenu.db') + Base.metadata.bind = engine + DBSession = sessionmaker(bind = engine) + ses = DBSession() + + restoList = ses.query(Restaurant).all() + if self.path.endswith("/restaurant"): self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() - output="" - output+="
" - output+="