"리눅스 Flask 설치"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(사용자 2명의 중간 판 4개는 보이지 않습니다)
7번째 줄: 7번째 줄:
==Flask 설치==
==Flask 설치==
*easy_install로 Flask 설치
*easy_install로 Flask 설치
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# easy_install flask
[root@zetawiki ~]# easy_install flask
Searching for flask
Searching for flask
Reading http://pypi.python.org/simple/flask/
Reading http://pypi.python.org/simple/flask/
81번째 줄: 81번째 줄:
Installed /usr/lib/python2.6/site-packages/MarkupSafe-0.23-py2.6-linux-x86_64.egg
Installed /usr/lib/python2.6/site-packages/MarkupSafe-0.23-py2.6-linux-x86_64.egg
Finished processing dependencies for flask
Finished processing dependencies for flask
</source>
</syntaxhighlight>
:→ Flask 0.10.1, itsdangerous 0.24, Jinja2 2.7.3, Werkzeug 0.9.6, MarkupSafe 0.23이 한번에 설치되었다.
:→ Flask 0.10.1, itsdangerous 0.24, Jinja2 2.7.3, Werkzeug 0.9.6, MarkupSafe 0.23이 한번에 설치되었다.


==Hello.py==
==Hello.py==
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# cd /var/www/
[root@zetawiki ~]# cd /var/www/
[root@jmnote www]# mkdir myflask
[root@zetawiki www]# mkdir myflask
[root@jmnote www]# cd myflask
[root@zetawiki www]# cd myflask
[root@jmnote myflask]# vi hello.py
[root@zetawiki myflask]# vi hello.py
</source>
</syntaxhighlight>
<source lang='python'>
<syntaxhighlight lang='python'>
from flask import Flask
from flask import Flask
app = Flask(__name__)
app = Flask(__name__)
101번째 줄: 101번째 줄:
if __name__ == '__main__':
if __name__ == '__main__':
app.run(host='0.0.0.0',port=8000)
app.run(host='0.0.0.0',port=8000)
</source>
</syntaxhighlight>
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote myflask]# python hello.py
[root@zetawiki myflask]# python hello.py
  * Running on http://0.0.0.0:8000/
  * Running on http://0.0.0.0:8000/
</sourcE>
</sourcE>


==(MySQL-python 설치)==
==(optional) MySQL-python 설치==
{{참고|MySQL-python 설치}}
{{참고|MySQL-python 설치}}
*(선택적) MySQL을 사용하려면 설치하자.
* MySQL을 사용하려면 설치하자.


==같이 보기==
==같이 보기==

2021년 9월 24일 (금) 23:24 기준 최신판

리눅스 Flask 설치

1 Python 설치[ | ]

2 Flask 설치[ | ]

  • easy_install로 Flask 설치
[root@zetawiki ~]# easy_install flask
Searching for flask
Reading http://pypi.python.org/simple/flask/
Best match: Flask 0.10.1
Downloading https://pypi.python.org/packages/source/F/Flask/Flask-0.10.1.tar.gz#md5=378670fe456957eb3c27ddaef60b2b24
Processing Flask-0.10.1.tar.gz
Running Flask-0.10.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-nf7Kih/Flask-0.10.1/egg-dist-tmp-gKr2Tf
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git'
Adding Flask 0.10.1 to easy-install.pth file

Installed /usr/lib/python2.6/site-packages/Flask-0.10.1-py2.6.egg
Processing dependencies for flask
Searching for itsdangerous>=0.21
Reading http://pypi.python.org/simple/itsdangerous/
Best match: itsdangerous 0.24
Downloading https://pypi.python.org/packages/source/i/itsdangerous/itsdangerous-0.24.tar.gz#md5=a3d55aa79369aef5345c036a8a26307f
Processing itsdangerous-0.24.tar.gz
Running itsdangerous-0.24/setup.py -q bdist_egg --dist-dir /tmp/easy_install-OghwuN/itsdangerous-0.24/egg-dist-tmp-7Wk3dP
warning: no previously-included files matching '*' found under directory 'docs/_build'
Adding itsdangerous 0.24 to easy-install.pth file

Installed /usr/lib/python2.6/site-packages/itsdangerous-0.24-py2.6.egg
Searching for Jinja2>=2.4
Reading http://pypi.python.org/simple/Jinja2/
Best match: Jinja2 2.7.3
Downloading https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz#md5=b9dffd2f3b43d673802fe857c8445b1a
Processing Jinja2-2.7.3.tar.gz
Running Jinja2-2.7.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-jwjYg1/Jinja2-2.7.3/egg-dist-tmp-M2ydTS
warning: no files found matching '*' under directory 'custom_fixers'
warning: no previously-included files matching '*' found under directory 'docs/_build'
warning: no previously-included files matching '*.pyc' found under directory 'jinja2'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'jinja2'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
Adding Jinja2 2.7.3 to easy-install.pth file

Installed /usr/lib/python2.6/site-packages/Jinja2-2.7.3-py2.6.egg
Searching for Werkzeug>=0.7
Reading http://pypi.python.org/simple/Werkzeug/
Best match: Werkzeug 0.9.6
Downloading https://pypi.python.org/packages/source/W/Werkzeug/Werkzeug-0.9.6.tar.gz#md5=f7afcadc03b0f2267bdc156c34586043
Processing Werkzeug-0.9.6.tar.gz
Running Werkzeug-0.9.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QvZNAn/Werkzeug-0.9.6/egg-dist-tmp-Hjtb7J
warning: no files found matching '*' under directory 'werkzeug/debug/templates'
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
Adding Werkzeug 0.9.6 to easy-install.pth file

Installed /usr/lib/python2.6/site-packages/Werkzeug-0.9.6-py2.6.egg
Searching for markupsafe
Reading http://pypi.python.org/simple/markupsafe/
Best match: MarkupSafe 0.23
Downloading https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz#md5=f5ab3deee4c37cd6a922fb81e730da6e
Processing MarkupSafe-0.23.tar.gz
Running MarkupSafe-0.23/setup.py -q bdist_egg --dist-dir /tmp/easy_install-TMwyJl/MarkupSafe-0.23/egg-dist-tmp-MPeXrW
Adding MarkupSafe 0.23 to easy-install.pth file

Installed /usr/lib/python2.6/site-packages/MarkupSafe-0.23-py2.6-linux-x86_64.egg
Finished processing dependencies for flask
→ Flask 0.10.1, itsdangerous 0.24, Jinja2 2.7.3, Werkzeug 0.9.6, MarkupSafe 0.23이 한번에 설치되었다.

3 Hello.py[ | ]

[root@zetawiki ~]# cd /var/www/
[root@zetawiki www]# mkdir myflask
[root@zetawiki www]# cd myflask
[root@zetawiki myflask]# vi hello.py
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
	return 'Hello World!'

if __name__ == '__main__':
	app.run(host='0.0.0.0',port=8000)

<syntaxhighlight lang='console'> [root@zetawiki myflask]# python hello.py

* Running on http://0.0.0.0:8000/

</sourcE>

4 (optional) MySQL-python 설치[ | ]

  • MySQL을 사용하려면 설치하자.

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}