Skip to content

Commit ece0a2f

Browse files
committed
flask app init
1 parent 80fd5fa commit ece0a2f

5 files changed

Lines changed: 350 additions & 1 deletion

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
.venv
33

44
# vscode
5-
.vscode
5+
.vscode
6+
7+
# python
8+
__pycache__

Pipfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7+
pytest = "*"
8+
pytest-cov = "*"
9+
pylint = "*"
710

811
[packages]
12+
flask = "*"
13+
flask-script = "*"
914

1015
[requires]
1116
python_version = "3.7"

Pipfile.lock

Lines changed: 306 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
app init
3+
"""
4+
5+
from flask import Flask
6+
7+
def create_app() -> (Flask):
8+
""" create_app() 함수를 호출해 앱을 초기화 """
9+
app = Flask(__name__)
10+
app.app_context().push()
11+
12+
@app.route("/")
13+
def index():
14+
""" / url index """
15+
return "<h1>Hello World ! <br> This is index page</h1>"
16+
17+
return app

manage.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
manage file
3+
"""
4+
5+
from flask_script import Manager
6+
from app import create_app
7+
8+
APP = create_app()
9+
10+
MANAGER = Manager(APP)
11+
12+
@MANAGER.command
13+
def run():
14+
""" Command application run """
15+
APP.run()
16+
17+
if __name__ == '__main__':
18+
MANAGER.run()

0 commit comments

Comments
 (0)