zoukankan      html  css  js  c++  java
  • uwsgi基础——快速入门

    原文:http://projects.unbit.it/uwsgi/wiki/Quickstart

    快速开始

    以下教程是官方版本,如果你使用的debian的包(完全模块化),你需要添加http和python模块。

    uWSGI-http+WSGI app

    现在来一个简单的例子:

    ( /var/www/hello.py )

    def application(env, start_response):
        start_response('200 OK', [('Content-Type','text/html')])
        return "Hello World"


    安装 uWSGI

    pip install uwsgi

    运行http请求: 9090

    uwsgi --http :9090 --wsgi-file /var/www/hello.py

    在浏览器里输入 localhost:9090

    uWSGI-http+Django

    Install uWSGI (如果没安装的话)

    pip install uwsgi

    使用ini配置文件配置django的端口到8000(可以叫django.ini)

    项目目录 /var/www/myapp

    django 版本>=1.4 ,使用这个文件(将myapp换成你的项目名字):

    [uwsgi]
    # set the http port
    http = :8000
    # change to django project directory
    chdir = /var/www/myapp
    # load django
    module = myapp.wsgi

    django之前的版本用下面的配置:

    [uwsgi]
    # set the http port
    http = :8000
    # change to django project directory
    chdir = /var/www/myapp
    # add /var/www to the pythonpath, in this way we can use the project.app format
    pythonpath = /var/www
    # set the project settings name
    env = DJANGO_SETTINGS_MODULE=myapp.settings
    # load django
    module = django.core.handlers.wsgi:WSGIHandler()


    运行

    uwsgi --ini django.ini

    浏览器里访问8000端口就能访问你的应用了。

    Nginx+uWSGI+flask

    没用这个,不看

    Apache2+uWSGI+multiple flask apps


    没用这个,不看

  • 相关阅读:
    流体力学笔记 第二章 流体力学的基本概念
    jvm常用的参数
    链表的反转
    数据流中的中位数
    二叉树对称
    二叉树镜像
    输入框校验
    判断单选或者复选框中选中的值
    网页中window.open 弹出 父页面和子页面数值交互
    数组去重
  • 原文地址:https://www.cnblogs.com/wanself/p/2789017.html
Copyright © 2011-2022 走看看