You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Signature: MethodView.as_view(name, *class_args, **class_kwargs)
Source:
@classmethoddefas_view(cls, name, *class_args, **class_kwargs):
"""Converts the class into an actual view function that can be used with the routing system. Internally this generates a function on the fly which will instantiate the :class:`View` on each request and call the :meth:`dispatch_request` method on it. The arguments passed to :meth:`as_view` are forwarded to the constructor of the class. """defview(*args, **kwargs):
self=view.view_class(*class_args, **class_kwargs)
returnself.dispatch_request(*args, **kwargs)
ifcls.decorators:
view.__name__=nameview.__module__=cls.__module__fordecoratorincls.decorators:
view=decorator(view)
# We attach the view class to the view function for two reasons:# first of all it allows us to easily figure out what class-based# view this thing came from, secondly it's also used for instantiating# the view class so you can actually replace it with something else# for testing purposes and debugging.view.view_class=clsview.__name__=nameview.__doc__=cls.__doc__view.__module__=cls.__module__view.methods=cls.methodsreturnviewFile: ~/.anyenv/envs/pyenv/versions/3.5.1/envs/dev_necco/lib/python3.5/site-packages/flask/views.pyType: method
The text was updated successfully, but these errors were encountered:
dodo5522
changed the title
configオブジェクトをViewクラス他全てに渡す
configurationファイルパスを外から指定できない
Jun 27, 2017
gunicornでアプリ起動する際に引数でパラメータ渡し可能。
Viewクラスにも
as_view
メソッド経由で渡せる。The text was updated successfully, but these errors were encountered: