tobby48 5 years ago
parent
commit
1ae9a399e2

+ 0
- 8
src/kr/co/swh/lecture/python/flask/helloworld1.py View File

@@ -1,8 +0,0 @@
1
-from flask import Flask
2
-app = Flask(__name__)
3
-@app.route("/")
4
-def hello():
5
-    return "<h1>SWHAcademy HelloWorld</h1>"
6
-
7
-if __name__ == "__main__":
8
-    app.run()

+ 0
- 8
src/kr/co/swh/lecture/python/flask/helloworld2.py View File

@@ -1,8 +0,0 @@
1
-from flask import Flask
2
-app = Flask(__name__)
3
-@app.route("/")
4
-def hello():
5
-    return "<h1>SWHAcademy HelloWorld</h1>"
6
-
7
-if __name__ == "__main__":
8
-    app.run(host="127.0.0.1", port="8080")

+ 0
- 10
src/kr/co/swh/lecture/python/flask/render_template.py View File

@@ -1,10 +0,0 @@
1
-from flask import Flask
2
-app = Flask(__name__)
3
-
4
-@app.route('/')
5
-def hello_html():
6
-    # html file은 현 파일이 위치한 디렉토리 하위 templates 폴더에 위치해야 함
7
-    return "render_template('render_template.html')"
8
-
9
-if __name__ == "__main__":              
10
-    app.run(host="127.0.0.1", port="8080")

+ 0
- 16
src/kr/co/swh/lecture/python/flask/routing.py View File

@@ -1,16 +0,0 @@
1
-from flask import Flask
2
-app = Flask(__name__)
3
-@app.route("/")
4
-def hello():
5
-    return "<h1>SWHAcademy HelloWorld</h1>"
6
-
7
-@app.route("/small")
8
-def hello_h2():
9
-    return "<h2>SWHAcademy HelloWorld</h2>"
10
-
11
-@app.route("/smallest")
12
-def hello_h3():
13
-    return "<h3>SWHAcademy HelloWorld</h3>"
14
-
15
-if __name__ == "__main__":
16
-    app.run(host="127.0.0.1", port="8080")

+ 0
- 33
src/kr/co/swh/lecture/python/flask/templates/index.ejs View File

@@ -1,33 +0,0 @@
1
-<html>
2
-	<head>
3
-  		<title><%= title %></title>
4
-		<link rel="stylesheet" type="text/css" href="css/style.css">
5
-  	</head>
6
-  	<body>
7
-	    <h1><%= title %></h1>
8
-	    <table>
9
-			<thead>
10
-				<tr>
11
-					<th>랭킹</th>
12
-					<th>키워드</th>
13
-					<th>빈도수</th>
14
-				</tr>
15
-			</thead>
16
-			<tbody>
17
-				<% for(var i=0; i<values.length; i++){ %>
18
-				<tr>
19
-					<td>
20
-		                <%= values[i].rank %>
21
-	            	</td>
22
-	            	<td>
23
-		                <%= values[i].keyword %>
24
-	            	</td>
25
-	            	<td>
26
-		                <%= values[i].num %>
27
-	            	</td>
28
-	            </tr>
29
-	        	<% } %>
30
-		    </tbody>
31
-		</table>
32
-  	</body>
33
-</html>

+ 0
- 8
src/kr/co/swh/lecture/python/flask/templates/jinja2.html View File

@@ -1,8 +0,0 @@
1
-<html>
2
-	<head>
3
-  		<title>SWH Sample</title>
4
-  	</head>
5
-  	<body>
6
-	    <h1>{{ user }}님 환영합니다.</h1>
7
-  	</body>
8
-</html>

+ 0
- 8
src/kr/co/swh/lecture/python/flask/templates/render_template.html View File

@@ -1,8 +0,0 @@
1
-<html>
2
-	<head>
3
-  		<title>SWH Sample</title>
4
-  	</head>
5
-  	<body>
6
-	    <h1>환영합니다.</h1>
7
-  	</body>
8
-</html>

+ 0
- 15
src/kr/co/swh/lecture/python/flask/url-for.py View File

@@ -1,15 +0,0 @@
1
-from flask import Flask, url_for
2
-app = Flask(__name__)
3
-@app.route("/hello/")
4
-def first():
5
-    return "안녕하세요"
6
-
7
-@app.route("/hello/<int:age>")
8
-def two(age):
9
-    "%d살이야." % age
10
-
11
-if __name__ == "__main__":
12
-    with app.test_request_context():
13
-        print(url_for('first'))
14
-        print(url_for('two', age=22))
15
-    #app.run(host="127.0.0.1", port="8080")

+ 0
- 12
src/kr/co/swh/lecture/python/flask/url-variable1.py View File

@@ -1,12 +0,0 @@
1
-from flask import Flask
2
-app = Flask(__name__)
3
-@app.route("/")
4
-def hello():
5
-    return "안녕하세요"
6
-
7
-@app.route("/<name>")   # 한글은 되지 않음
8
-def name_hello(name):
9
-    return name + "야 안녕"
10
-
11
-if __name__ == "__main__":
12
-    app.run(host="127.0.0.1", port="8080")

+ 0
- 12
src/kr/co/swh/lecture/python/flask/url-variable2.py View File

@@ -1,12 +0,0 @@
1
-from flask import Flask
2
-app = Flask(__name__)
3
-@app.route("/")
4
-def hello():
5
-    return "안녕하세요"
6
-
7
-@app.route("/<int:age>")
8
-def age_hello(age):
9
-    "%d살이야." % age
10
-
11
-if __name__ == "__main__":
12
-    app.run(host="127.0.0.1", port="8080")