written by Armin Ronacher on 2016-05-29 in Releases After a very long, long waiting time Flask finally got a new release. There really was no good reason that there has not been a release in such a long time but unfortunately once things are postponed for too long a certain release anxiety kicks in. In this case this was long tagged as 1.0 but we decided for renaming it to 0.11 and back out some o
本日ついに、Flaskのnew versionがリリースされました。めでたいですね! 前回のリリースが2013/06/14だったので、ほぼ3年ぶりです。 バージョンを1.0に上げるという話がありマイルストーンも立っていましたが、0.11としてリリースされました。 1.0にしなかったのは、Flaskのコマンドラインインタフェースが特に大きな理由となっているようです。 この記事では、そのコマンドラインインタフェースを追ってみます。 Flask 0.11 Released | The Pallets Projects Flask-Script これまでdjangoのmanage.pyみたいなものが欲しい場合、Flask-Scriptというライブラリがよく使われていたと思います。 # http://flask-script.readthedocs.io/en/latest/ # manage.py
Pythonの軽量WebフレームワークFlask導入にあたり、DBアクセスとテンプレート継承有りでRailsと比較しました。外部のWeb Framework Benchmarksと異なったRailsの方が早いという結果がでたので原因を特定して解消する記事です。 ベンチマーク結果 個人PJでの利用を想定しているので、用途に特化したベンチマークを書いて比較しました。結果Rails はFlask より1.493倍高速に動作 することが判明しました。Railsすんごいはやい。 Web Framework Benchmarksと異なる結果になった Web Framework Benchmarksと異なる結果になりました。Flaskが遅いのはコード側に問題がありそうなので検証していきます。 ベンチマーク条件 用途に特化したベンチマーク試験となっています。 DBアクセスして1レコード取得し結果をテンプレ
Flask の test_client() とか test_request_context() とか app_context()。 The Application Context The Request Context flask/app.py flask/ctx.py flask/testing.py werkzeug/test.py Flask-Testing Flask.wsgi_app() の動作 class Flask(_PackageBoundObject): # ... def wsgi_app(self, environ, start_response): with self.request_context(environ): try: response = self.full_dispatch_request() except Exception, e: response
ISUCON の季節ですね。 ISUCON では慣習的に各言語で代表的なマイクロフレームワークが使われるのですが、 Python では今のところ Flask がずっと使われています。 Flask は確かに、簡単なサンプルアプリを書くときの見た目はマイクロフレームワークになっています。 しかし、構造的には沢山のフック、シグナルがあったりしていて、重量級の設計になっています。 Flask 本体と Werkzeug を合わせると数万行のサイズです。単なる Hello World アプリでも、数十の関数呼び出しが裏で動いています。 Bottle も、 Flask と同じくマルチスレッド対応で、スレッドローカルを使ったコンテキストスタックがある、拡張機能もあるフレームワークですが、構造は Flask よりも大分質素です。 ソースコードも1ファイル3000行代で、その分フレームワークのオーバーヘッドも
Flask 0.7 introduces pluggable views inspired by the generic views from Django which are based on classes instead of functions. The main intention is that you can replace parts of the implementations and this way have customizable pluggable views. Basic Principle¶ Consider you have a function that loads a list of objects from the database and renders into a template: @app.route('/users/') def show
API¶ This part of the documentation covers all the interfaces of Flask. For parts where Flask depends on external libraries, we document the most important right here and provide links to the canonical documentation. Application Object¶ class flask.Flask(import_name, static_path=None, static_url_path=None, static_folder='static', template_folder='templates', instance_path=None, instance_relative_c
Even after deploying a number of Flask apps I always find myself googling up blog posts on how to get the trio of nginx, gunicorn and supervisor working together. Below is simple, straight, no-nonsense guide on how to deploy a flask app on a Linux server using Nginx, Gunicorn and Supervisor. A disclaimer: this guide will not tell you what these technologies are. Specifically, I will not talk about
foo.log �i��U A warning occurred (42 apples) An error occurred server.py Ёf��U � h��U import logging from logging.handlers import RotatingFileHandler from flask import Flask app = Flask(__name__) @app.route('/') def foo(): app.logger.warning('A warning occurred (%d apples)', 42) app.logger.error('An error occurred') app.logger.info('Info') return "foo" if __name__ == '__main__': handler = Rotating
Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. It began as a simple wrapper around Werkzeug and Jinja and has become one of the most popular Python web application frameworks. Flask offers suggestions, but doesn't enforce any dependencies or project layout. It is up to the developer
Flask なんでそこまで大規模ではないですが、 1ファイルでは厳しくなってたので分割しました。 Flask 0.7.2 を使用で、 より大きなアプリケーション ― Flask v0.5.1 documentation http://a2c.bitbucket.org/flask/patterns/packages.html に従って、Module で定義すると、起動時に次のような警告。 (起動はするので動きはする main.py:7: DeprecationWarning: Modules are deprecated. Upgrade to using blueprints. Have a look into the documentation for more information. If this module was registered by a Flask-Extensio
Presented at EuroPython 2012. The abstract: "In the last year we have been working on a full featured, Python powered, RESTful Web API. We learned quite a few things on REST best patterns, and we got a chance to put Python’s renowned web capabilities under review, even releasing a couple Open Source projects in the process. In my talk I will share what we learned. We will consider ‘pure’ REST API
API¶ This part of the documentation covers all the interfaces of Flask. For parts where Flask depends on external libraries, we document the most important right here and provide links to the canonical documentation. Application Object¶ class flask.Flask(import_name, static_url_path=None, static_folder='static', static_host=None, host_matching=False, subdomain_matching=False, template_folder='temp
Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. It began as a simple wrapper around Werkzeug and Jinja and has become one of the most popular Python web application frameworks. Flask offers suggestions, but doesn't enforce any dependencies or project layout. It is up to the developer
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く