Hello, world
This commit is contained in:
parent
6349f7e60e
commit
29248ed76e
13
README.md
13
README.md
@ -2,8 +2,21 @@
|
|||||||
# ATST
|
# ATST
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
brew install python3
|
brew install python3
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
## Running (development)
|
||||||
|
|
||||||
|
DEBUG=1 ./app.py
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
tornado templates are like mustache templates -- add the
|
||||||
|
following to `~/.vim/filetype.vim` for syntax highlighting:
|
||||||
|
|
||||||
|
:au BufRead *.html.to set filetype=mustache
|
||||||
|
|
||||||
|
22
app.py
Executable file
22
app.py
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import tornado.ioloop
|
||||||
|
import tornado.web
|
||||||
|
import os
|
||||||
|
|
||||||
|
class MainHandler(tornado.web.RequestHandler):
|
||||||
|
def get(self):
|
||||||
|
self.render("hello.html.to")
|
||||||
|
|
||||||
|
def make_app():
|
||||||
|
return tornado.web.Application([
|
||||||
|
(r"/", MainHandler),
|
||||||
|
],
|
||||||
|
template_path='./templates',
|
||||||
|
debug=os.getenv('DEBUG',False),
|
||||||
|
)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = make_app()
|
||||||
|
app.listen(8888)
|
||||||
|
tornado.ioloop.IOLoop.current().start()
|
14
templates/base.html.to
Normal file
14
templates/base.html.to
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>{% block title %}your title here{% end %}</title>
|
||||||
|
</head>
|
||||||
|
<h1>{% block title %}your title here again{% end %}</h1>
|
||||||
|
<body>
|
||||||
|
<ul>
|
||||||
|
{% block content %}
|
||||||
|
your content goes here
|
||||||
|
{% end %}
|
||||||
|
</ul>
|
||||||
|
</body>
|
||||||
|
</html>
|
10
templates/hello.html.to
Normal file
10
templates/hello.html.to
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{% extends "base.html.to" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
this is an amazing title for hello
|
||||||
|
{% end %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
This is more content for hello
|
||||||
|
{% end %}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user