Did you know that Flask has its origins in an April fools joke that unexpectedly took off? Listen in this week to hear about the history, current state, and future of Flask with its creator Armin Ronacher. You'll learn how he's using Python as the backend for a set of major computer games. His thoughts on the future of web development and HTTP 2. And why Rust is an amazing new language you should
Flask にはエラーハンドラという機構がある。 これは Web アプリケーションの中でハンドルされなかった例外を HTTP のレスポンスに変換するというものだ。 つまり、どれだけ呼び出しの深い場所にいてもエラーが起こったときには例外さえ上げればクライアントに適切なレスポンスが返るという便利な仕組み。 同様の機構は、他の Web アプリケーションフレームワークでも JAX-RS (Java) の例外マッパーや Pyramid (Python) の例外ビューとして見られる。 今回はその便利なエラーハンドラについて書いてみる。 まずは何はともあれ Flask をインストールする。 最初のサンプルコードは 404 エラーをレスポンスに変換するというものだ。 エラーハンドラが登録されていない場合はデフォルトのエラーメッセージが HTML で返ることになるが、WebAPI を実装する場合などにはそれ
Introduction There are many methods and conventions for structuring Python web applications. Although certain frameworks are shipped with tools (for scaffolding) to automate – and ease – the task (and the headaches), almost all solutions rely on packaging / modularizing applications as the codebase gets distributed [logically] across related files and folders. The minimalist web application develo
Happy New Year! In 2024, more than 500k developers spent a combined 59 million hours programming, tracked with WakaTime plugins. The average person spent 51 minutes per day programming, a slight incre…
Let’s look at the small, yet powerful JavaScript UI library ReactJS in action, as we build a basic web application. This app is powered by Python 3 and the Flask framework in the back-end and React in the front. In addition, we will use gulp.js (task runner), bower (front-end package manager), and Browserify (JavaScript dependency bundler). Part 1 – Getting Started (current) Part 2 – Developing a
In this article I'm going to introduce an authentication scheme known as two factor authentication. As the name implies, this method requires the user to provide two forms of identification: a regular password and a one-time token. This greatly increases account security, because a compromised password alone is not enough to gain access, an attacker also needs to have the token, which is different
はじめに 今勉強用に作ってるWebアプリケーションで、htmlからDELETEメソッドを送りたかったので調べてみると、htmlのformではdeleteやputなどのhttpメソッドが使えないらしい。 対策 ↓のページを見つけた Custom HTTP methods from flask import _request_ctx_stack @app.before_request def before_request(): method = request.form.get('_method', '').upper() if method: request.environ['REQUEST_METHOD'] = method ctx = _request_ctx_stack.top ctx.url_adapter.default_method = method assert request
とりあえずなんとか動きましたって感じで... 以下Vagrant上での作業です。細かい所はあとで。 Python3.4を入れる $ sudo rpm -ivh http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm $ sudo yum install python34u.x86_64 python34u.x86_64_devel develはuWSGIを入れる時に必要です。pipとsetuptoolは自動的に入ります。 uWSGIをインストール $ sudo pip3 install uwsgi システム全体で同じuWSGIを使うため、virtualvenv等を利用せずグローバルに入れます。 Nginxをインストール 現時点で安定版の最新が1.6
昨日は Python のウェブフレームワーク Flask で簡単な応答システムを作りました。これだけだとあまりに退屈なので、せっかくですから NumPy を利用して少しは楽しめるものを作ってみたいと思います。 「ガチャ」とは、最近流行のソーシャルゲームやオンラインゲームにおいて 1 回課金することによってアイテム等をランダムに入手できる仕組みのことです。 10 連ガチャとは 1 回の試行で 10 回分のレアガチャを引く仕組みのことです。基本無料を謳うソーシャルゲームなどでは、このようなアイテム課金で利益を得る仕組みになっています。 シミュレーションの目的としては、運営サイドとしてはプレイヤーがじゃぶじゃぶ課金したくなるような射幸心を煽りまくるガチャが提供できているかどうか確認する、プレイヤーサイドとしてはリアルマネーいわゆる実際のお金を投入する前にあらかじめどれくらいの確率で成功するのかを
WebアプリフレームワークのFlask(が内部で使っているWerkzeug)は、デバッグモードをONにしておくとエラーが起きた時にそのエラー画面からブラウザ上で対話的にコードを実行したり変数を表示させたりしてデバッグが出来る。これは超便利。なのだけど、最近JSからAPIを叩くケースが多くなって、その場合JSが予期しないHTMLを受け取ってパースに失敗するだけなので折角の対話的デバッグが生かせない。 そこで、エラー時には新しいwindowを開いて、レスポンスの内容をそちらに書き出すようにした。初回だけポップアップブロックが発動してしまうけど、それ以降はこれでAPIでも対話的デバッグが出来る。 $.ajax({ url:'/buggy/', data: 'q=42', success: function(x){console.log(x)}, error:function(x){ var w
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く