LoginSignup
0
0

More than 5 years have passed since last update.

uWSGI の簡単な使い方

Last updated at Posted at 2018-10-28

Arch Linux でのインストール

sudo pacman -S uwsgi
sudo pacman -S uwsgi-plugin-python
foobar.py
# -*- coding: utf-8 -*-
#
#   foobar.py
#
#                       Oct/18/2018
# 
# ------------------------------------------------------------------
def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    rvalue = b"<h2>Hello World</h2>"
    rvalue += b"<blockquote>"
    rvalue += b"\tTest<p />"
    rvalue += b"</blockquote>"
    rvalue += b"\tOct/28/2018 PM 20:36<p />"
    return rvalue
# ------------------------------------------------------------------

サーバーの起動

uwsgi --plugin http,python --http :9090 --wsgi-file foobar.py

クライアントで http://localhost:9090/ にアクセス
uwsgi_oct28.png

確認した環境

$ uname -a
Linux iwata 4.18.16-arch1-1-ARCH #1 SMP PREEMPT Sat Oct 20 22:06:45 UTC 2018 x86_64 GNU/Linux
[uchida@iwata uwsgi]$ python --version
Python 3.7.1
[uchida@iwata uwsgi]$ uwsgi --version
2.0.17.1
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0