Production search engine
This commit is contained in:
parent
ccaeb5240e
commit
67a3be50d3
11
search.py
11
search.py
@ -3,7 +3,6 @@
|
||||
# You can test it with:
|
||||
# curl --request POST --data string=foobar\&what=language http://localhost:4000
|
||||
|
||||
import wsgiref.simple_server as server
|
||||
import urllib.parse
|
||||
|
||||
# PostgreSQL interface
|
||||
@ -12,7 +11,6 @@ import psycopg2
|
||||
# HTML templates http://www.yattag.org/
|
||||
from yattag import Doc
|
||||
|
||||
PORT = 4000
|
||||
REDIRECTION_URL = "https://www.langtag.net/registries/registry-html" # For
|
||||
# local testing: Firefox apparently does not accept a redirect to a
|
||||
# file.
|
||||
@ -119,9 +117,6 @@ def application(environ, start_response):
|
||||
text("\"%s\" not found\r\n" % term)
|
||||
return pack(start_response, status, title, doc, headers)
|
||||
|
||||
if __name__ == "__main__":
|
||||
conn = psycopg2.connect("dbname=lsr")
|
||||
cursor = conn.cursor()
|
||||
httpd = server.make_server("", PORT, application)
|
||||
print("Listening on port %s" % PORT)
|
||||
httpd.serve_forever()
|
||||
# Initialize
|
||||
conn = psycopg2.connect("dbname=lsr")
|
||||
cursor = conn.cursor()
|
||||
|
Loading…
Reference in New Issue
Block a user