Skip to content

Commit bf7d05e

Browse files
committed
asyn
1 parent d20c79c commit bf7d05e

7 files changed

Lines changed: 36 additions & 0 deletions

File tree

3code/web/application.pyc

0 Bytes
Binary file not shown.

3code/web/handlers/sleep.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
# coding=utf-8
3+
4+
from base import BaseHandler
5+
6+
import time
7+
8+
class SleepHandler(BaseHandler):
9+
def get(self):
10+
time.sleep(17)
11+
self.render("sleep.html")
12+
13+
class SeeHandler(BaseHandler):
14+
def get(self):
15+
self.render("see.html")

3code/web/handlers/sleep.pyc

1.06 KB
Binary file not shown.

3code/web/templates/see.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "base.html" %}
2+
3+
{% block header %}
4+
<h2>I hope see you just now.</h2>
5+
{% end %}
6+
7+
{% block body %}
8+
{% end %}

3code/web/templates/sleep.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% extends "base.html" %}
2+
3+
{% block header %}
4+
<h2>I am sleeping in 7s.</h2>
5+
{% end %}
6+
7+
{% block body %}
8+
<p>Please waiting</p>
9+
{% end %}

3code/web/url.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
from handlers.index import ErrorHandler
1212
from handlers.index import RegisterHandler
1313
from handlers.user import UserHandler
14+
from handlers.sleep import SleepHandler
15+
from handlers.sleep import SeeHandler
1416

1517
url = [
1618
(r'/', IndexHandler),
1719
(r'/error', ErrorHandler),
1820
(r'/login', RegisterHandler),
1921
(r'/user', UserHandler),
22+
(r'/sleep', SleepHandler),
23+
(r'/see', SeeHandler),
2024
]

3code/web/url.pyc

149 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)