-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
40 lines (29 loc) · 1.22 KB
/
main.py
File metadata and controls
40 lines (29 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import tornado.ioloop
import tornado.web
import tornado.websocket
from Game import Deck, MessageHandler
class MainHandler(tornado.web.RequestHandler):
def get(self):
items = ["Andrzej", "Bartek", "Marcin", "Natalia"]
deck = Deck.Deck()
self.render("Templates/index.html", title="1000 App", items=items, musik=deck.create_musik(), cards=deck.cards)
class GameHandler(tornado.web.RequestHandler):
def get(self):
self.render("Templates/instructions.html", title="1000 App")
class InstructionHandler(tornado.web.RequestHandler):
def get(self):
self.render("Templates/instructions.html")
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
(r"/websocket", MessageHandler.MessageHandler),
(r"/game", GameHandler),
(r"/instruction", InstructionHandler),
(r'/static/css/(.*)', tornado.web.StaticFileHandler, {'path': './static/css'}),
(r'/static/js/(.*)', tornado.web.StaticFileHandler, {'path': './static/js'}),
(r"/static/images/(.*)", tornado.web.StaticFileHandler, {"path": "./static/images"})
])
if __name__ == "__main__":
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()