python编程(uwsgi和webpy)

栏目: Python · 发布时间: 8年前

内容简介:python编程(uwsgi和webpy)

【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】

生产中,常用nginx+uwsgi+webpy的方法进行环境部署,今天学习了一下怎么用uwsgi+webpy部署网站,记录一下。

1、准备一个基于webpy的文件server.py

#!/usr/bin/python
import web

urls = ('/', 'Hello')

class Hello(object):
    def GET(self):
        return 'Hello world'

app = web.application(urls, globals())
application = app.wsgifunc()

2、安装uwsgi

sudo apt-get install uwsgi

3、安装uwsgi下的 python 插件

sudo apt-get install uwsgi-plugin-python

4、准备uwsgi的配置文件,假设为cf.ini

[uwsgi]
http-socket    = :9090
plugin    = python
wsgi-file = /media/sf_Desktop/process/server.py
process   = 3

5、利用uwsgi运行ini文件

uwsgi --ini cf.ini

6、检验网站是否运行

在浏览器中输入127.0.0.1:9090即可。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

High-Performance Compilers for Parallel Computing

High-Performance Compilers for Parallel Computing

Michael Wolfe / Addison-Wesley / 1995-6-16 / USD 117.40

By the author of the classic 1989 monograph, Optimizing Supercompilers for Supercomputers, this book covers the knowledge and skills necessary to build a competitive, advanced compiler for parallel or......一起来看看 《High-Performance Compilers for Parallel Computing》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具