티스토리 뷰
공부
[Python] flask swagger (ImportError: cannot import name 'cached_property' from 'werkzeug'; AttributeError: 'function' object has no attribute 'as_view')
승가비 2020. 5. 31. 11:57728x90
# requirements.txt
flask
flask_restplus
werkzeug==0.16.0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from flask import Flask
from flask_restplus import Api, Resource, fields
from argparse import ArgumentParser
app = Flask(__name__)
api = Api(
app,
version='1.0',
title='Bot API',
description='A bot API',
)
app = Flask(__name__)
port = os.getenv('PORT', 80)
debug = True
@api.route('/', methods=['GET'])
class Controller(Resource):
def home(self):
return 'Hello World!'
if __name__ == '__main__':
arg_parser = ArgumentParser(
usage='Usage: python ' + __file__ + ' [--port <port>] [--help]'
)
arg_parser.add_argument('-p', '--port', default=port, help='port')
arg_parser.add_argument('-d', '--debug', default=debug, help='debug')
options = arg_parser.parse_args()
app.run(host='0.0.0.0', debug=options.debug, port=options.port, )
https://github.com/jarus/flask-testing/issues/143
https://flask-restplus.readthedocs.io/en/stable/swagger.html
### namespace
https://flask-restplus.readthedocs.io/en/stable/swagger.html
https://flask-restplus.readthedocs.io/en/stable/scaling.html
https://flask-restplus.readthedocs.io/en/stable/api.html
https://stackoverflow.com/questions/15231359/split-python-flask-app-into-multiple-files
https://github.com/noirbizarre/flask-restplus/issues/286
github.com/noirbizarre/flask-restplus/issues/247#issuecomment-402048647
728x90
'공부' 카테고리의 다른 글
[Python] Content-Type & MIME-Type (0) | 2020.05.31 |
---|---|
[Python] execute timeout (0) | 2020.05.31 |
[Developer] Common Sense (0) | 2020.05.30 |
[Spark] merge small files (0) | 2020.05.30 |
[Python] slack message bot (0) | 2020.05.30 |
댓글
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- COUNT
- 테슬라 리퍼럴 코드 혜택
- 어떻게 능력을 보여줄 것인가?
- 테슬라 레퍼럴
- 개리마커스
- 레퍼럴
- 김달
- 테슬라
- follower
- 모델y
- 테슬라 레퍼럴 코드 확인
- 테슬라 레퍼럴 적용 확인
- Kluge
- 모델 Y 레퍼럴
- wlw
- 할인
- 인스타그램
- 책그림
- Bot
- 테슬라 리퍼럴 코드 생성
- 유투브
- 테슬라 크레딧 사용
- 테슬라 리퍼럴 코드
- 테슬라 추천
- 메디파크 내과 전문의 의학박사 김영수
- 팔로워 수 세기
- 클루지
- 연애학개론
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함