1.web.pyインストール
sudo easy_install web.py
2.実行
街角のリブロガー: Djangoより軽いフレームワーク探し中
ここのHelloworldソースコードを作成して、
gunicorn app:app
これで実行。
パラメータは、
gunicorn <モジュール名>:WSGI戻り値を格納している変数名
というようになっている。
インターネット上にある断片化された情報を切り取って、リブログする。 主にソフトウェア、Ubuntu関連、CPUなど気になったニュース、また、日々の面白い出来事やニュースもリブログします。
2010年12月14日火曜日
2010年12月13日月曜日
nginx + gunicorn + django設定例
さまざまなサイトで公開されているので必要ないけども、
fastcgiからgunicornへ移行したときの手順を自分用にまとめておいておく。
参考になったらいいな程度に手順をまとめる。
1.gunicornインストール
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py -U setuptools
easy_install -U gunicorn
2.nginx + gunicorn + djangoの場合
setting.pyを開いて、
INSTALLED_APPSに
"gunicorn",
を追加する。
nginxの設定ファイルを開いて、ルートドキュメントセクション内に
設定例:
python maange.py run_gunicornでまずdjangoアプリ起動
それからnginxデーモンを再起動。
http://localhost/にアクセスしてみる。
正常にページがロードされたら成功。
参照URL
http://gunicorn.org/install.html
http://gunicorn.org/run.html
fastcgiからgunicornへ移行したときの手順を自分用にまとめておいておく。
参考になったらいいな程度に手順をまとめる。
1.gunicornインストール
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py -U setuptools
easy_install -U gunicorn
2.nginx + gunicorn + djangoの場合
setting.pyを開いて、
INSTALLED_APPSに
"gunicorn",
を追加する。
nginxの設定ファイルを開いて、ルートドキュメントセクション内に
設定例:
location / {
#host to gunicorn server
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://127.0.0.1:8000;
break;
}
##host and port to fastcgi server
#fastcgi_pass 127.0.0.1:8080;
#fastcgi_param PATH_INFO $fastcgi_script_name;
#fastcgi_param REQUEST_METHOD $request_method;
#fastcgi_param QUERY_STRING $query_string;
#fastcgi_param CONTENT_TYPE $content_type;
#fastcgi_param CONTENT_LENGTH $content_length;
#fastcgi_pass_header Authorization;
#fastcgi_intercept_errors off;
}
python maange.py run_gunicornでまずdjangoアプリ起動
それからnginxデーモンを再起動。
http://localhost/にアクセスしてみる。
正常にページがロードされたら成功。
参照URL
http://gunicorn.org/install.html
http://gunicorn.org/run.html
ラベル:
webserver
登録:
コメント (Atom)