-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
236 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
from todoapp import Application | ||
import sys | ||
|
||
Application().run() | ||
entry = "/todos" | ||
|
||
if len(sys.argv) > 1: | ||
entry = sys.argv[1] | ||
|
||
Application().redirect_to_singleton(entry) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+305 Bytes
(100%)
examples/todoapp/todoapp/media/img/users-between-lines.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from http.server import HTTPServer, SimpleHTTPRequestHandler | ||
from threading import Thread | ||
import json | ||
from .page import Error404, Redirect | ||
|
||
|
||
class ApplicationServer(HTTPServer): | ||
class RequestHandler(SimpleHTTPRequestHandler): | ||
def do_GET(self): | ||
try: | ||
_, response = self.server.app.url(self.path) | ||
except Error404: | ||
self.send_response(404) | ||
self.send_header( | ||
'Content-Type', 'application/x-json', | ||
) | ||
self.end_headers() | ||
return self.wfile.write(json.dumps({ | ||
"ok": False, | ||
"status": 404, | ||
}).encode()) | ||
else: | ||
self.send_response(200) | ||
self.send_header( | ||
'Content-Type', 'application/x-json', | ||
) | ||
self.end_headers() | ||
return self.wfile.write(json.dumps(response or { | ||
"ok": True, | ||
"status": 200, | ||
}).encode()) | ||
|
||
|
||
def __init__(self, app, address): | ||
self.app = app | ||
super().__init__(address, self.RequestHandler) | ||
|
||
def thread_serve(self): | ||
self.thread = Thread( | ||
target=self.serve_forever, | ||
) | ||
self.thread.setDaemon(True) | ||
self.thread.start() | ||
# self.app.on_close(self.thread.kill) | ||
return self.thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.