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