mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Initial tornado application
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
import WebSiteHandler
|
||||
# import WebSiteHandler
|
||||
import tornado.ioloop
|
||||
|
||||
from app.Chameleon_Vision_App import ChameleonApplication
|
||||
from tornado.options import options
|
||||
|
||||
if __name__ == "__main__":
|
||||
WebSiteHandler.run_all()
|
||||
# WebSiteHandler.run_all()
|
||||
tornado.options.parse_command_line()
|
||||
app = ChameleonApplication()
|
||||
print(f"Serving on port {options.port}")
|
||||
app.listen(options.port)
|
||||
tornado.ioloop.IOLoop.current().start()
|
||||
|
||||
@@ -32,3 +32,4 @@ def run_all():
|
||||
socket_process = multiprocessing.Process(target=test)
|
||||
html_process.start()
|
||||
socket_process.start()
|
||||
|
||||
|
||||
0
Python/__init__.py
Normal file
0
Python/__init__.py
Normal file
21
Python/app/Chameleon_Vision_App.py
Normal file
21
Python/app/Chameleon_Vision_App.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import tornado.web
|
||||
import tornado.websocket
|
||||
import os
|
||||
|
||||
from handlers.MainHandler import MainHandler
|
||||
from tornado.options import define
|
||||
|
||||
define("port", default=8888, help="run on the given port", type=int)
|
||||
|
||||
|
||||
class ChameleonApplication(tornado.web.Application):
|
||||
def __init__(self):
|
||||
handlers = [(r"/", MainHandler),
|
||||
(r"/CSS/(.*)", tornado.web.StaticFileHandler, {'path': os.path.join(os.path.dirname(__file__), "../../Site/CSS")}),
|
||||
(r"/JS/(.*)", tornado.web.StaticFileHandler,
|
||||
{'path': os.path.join(os.path.dirname(__file__), "../../Site/JS")})]
|
||||
settings = dict(
|
||||
template_path=os.path.join(os.path.dirname(__file__), "../../Site")
|
||||
)
|
||||
|
||||
super(ChameleonApplication, self).__init__(handlers, **settings)
|
||||
0
Python/app/__init__.py
Normal file
0
Python/app/__init__.py
Normal file
BIN
Python/app/__pycache__/Chameleon_Vision_App.cpython-37.pyc
Normal file
BIN
Python/app/__pycache__/Chameleon_Vision_App.cpython-37.pyc
Normal file
Binary file not shown.
BIN
Python/app/__pycache__/__init__.cpython-37.pyc
Normal file
BIN
Python/app/__pycache__/__init__.cpython-37.pyc
Normal file
Binary file not shown.
6
Python/app/handlers/MainHandler.py
Normal file
6
Python/app/handlers/MainHandler.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import tornado.web
|
||||
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
def get(self):
|
||||
self.render("index.html")
|
||||
0
Python/app/handlers/__init__.py
Normal file
0
Python/app/handlers/__init__.py
Normal file
BIN
Python/app/handlers/__pycache__/MainHandler.cpython-37.pyc
Normal file
BIN
Python/app/handlers/__pycache__/MainHandler.cpython-37.pyc
Normal file
Binary file not shown.
BIN
Python/app/handlers/__pycache__/__init__.cpython-37.pyc
Normal file
BIN
Python/app/handlers/__pycache__/__init__.cpython-37.pyc
Normal file
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Chameleon Vision</title>
|
||||
<link rel="stylesheet" type="text/css" href="../CSS/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="CSS/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
|
||||
Reference in New Issue
Block a user