기본 콘텐츠로 건너뛰기

Flask 설치

Flask 설치

OS : ubuntu 12.04.5 LTS 에서 진행함

1. python 설치

(ubuntu 12.04.5 LTS에 기본적으로 Pyhon 2.7.3 버전 설치되어 있음)

2. 기존 바이너리 업그레이드 (꼭 해줘야 하는지는 모르겠음)

sudo apt-get update

sudo apt-get upgrade -y

3. Pip 설치 (현재 pip 7.1.0 설치됨)

curl " https://bootstrap.pypa.io/get-pip.py " -o "get-pip.py"

sudo python get-pip.py

4. Flask 설치

sudo pip install flask

5. 간단한 웹서버 구동 테스트

5-1. helloworld.py 라는 파일을 아래와 같이 작성 후 저장

from flask import Flask

app = Flask(__name__)

@app.route("/")

def hello():

return "Hello World!"

if __name__ == "__main__":

app.run('0.0.0.0', 5000)

5-2. python 으로 해당 helloworld.py 실행 후, 웹브라우저에서 "Hello World" 확인 가능

python helloworld.py

(참고 http://www.liquidweb.com/kb/how-to-install-pip-on-ubuntu-12-04-lts/ )

(참고 http://developer.codero.com/community/installing-flask-on-ubuntu/ )

공유하기 글 요소 저작자표시

from http://smarth.tistory.com/1 by ccl(A) rewrite - 2020-03-07 00:54:34

댓글

이 블로그의 인기 게시물

Flask 13. pythonanywhere에 배포하기

Flask 13. pythonanywhere에 배포하기 Login: PythonAnywhere It's always a pleasure to hear from you! Ask us a question, or tell us what you love or hate about PythonAnywhere. We'll get back to you over email ASAP. Sorry, there was an error connecting to the server. Please try again in a few moments... www.pythonanywhere.com from http://ohdowon064.tistory.com/124 by ccl(A) rewrite - 2020-03-11 15:54:10

[ubuntu] FLASK_APP

[ubuntu] FLASK_APP Development/Debugging 🐞 FLASK_ENV=development FLASK_APP = app.py flask run zsh: command not found: FLASK_APP ✔️ FLASK_ENV=development FLASK_APP=app.py flask run 띄어쓰기를 해서 저런 오류를 출력할수도 있구나 😲 참고 : 108p에서 FLASK가 FKAS로 오타나있다. from http://hee-stories.tistory.com/18 by ccl(A) rewrite - 2020-03-24 17:20:11