기본 콘텐츠로 건너뛰기

[Python, Flask] 에러발생시키기

[Python, Flask] 에러발생시키기

[Python, Flask] 에러발생시키기

-----------------------------------------------

from flask import Flask, request, url_for, abort, redirect app = Flask(__name__)

@app.route( '/' ) def index(): return redirect(url_for( 'login' )) # 로그인으로 리다이렉트

@app.route( '/login' ) def login(): abort( 403 ) # 403 오류 발생(forbidden) 404 not found this_is_never_executed() #여기는 실행이 안됨

HTTP Error code

401: Unauthorized

403: Forbidden

404: Not Found

405: Method Not Allowed

406: Not Acceptable

408: Request Timeout

409:Conflict(A conflict happened while processing the request. The resource might have been modified while the request was being processed)

410:Gone

411:Length Required

413:Request Entity Too Large

414:Request URI Too Long

415:Unsupported Media Type

416:Requested Range Not Satisfiable

417:Expectation Failed

418:I'm a teapot

422: Unprocessable Entity (The request was well-formed but was unable to be followed due to semantic errors.)

423: Locked (The resource that is being accessed is locked.)

428: Precondition Required (This request is required to be conditional; try using "If-Match" or "If-Unmodified-Since".)

429: Too Many Requests (This user has exceeded an allotted request count. Try again later.)

431: Request Header Fields Too Large (One or more header fields exceeds the maximum size.)

500: Internal Server Error

501: Not Implemented( The server does not support the action requested by the browser.)

502: Bad Gateway (The proxy server received an invalid response from an upstream server.)

503: Service Unavailable ( The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.)

504: Gateway Timeout (The connection to an upstream server timed out.)

505: HTTP Version Not Supported( The server does not support the HTTP protocol version used in the requst)

from http://fenderist.tistory.com/100 by ccl(A) rewrite - 2020-03-06 12:54:20

댓글

이 블로그의 인기 게시물

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