做过的事如果不记下来很容易就忘了。。。还是应该养成记blog的习惯啊
安装 easy_install:
sudo apt-get install python-setuptools
安装web.py:
sudo easy_install web.py
安装apache服务器:
apt-get install apache2
安装mod-wsgi:
sudo apt-get install libapache2-mod-wsgi
编辑/etc/apache2/sites-available/default,在<VirtualHost *:80> 下加入:
ServerName webapp.com
DocumentRoot /home/webapp
<Directory /home/webapp>
Order allow,deny
Allow from all
</Directory>
Alias /static /home/webapp/static
Alias /favicon.ico /home/webapp/static
WSGIDaemonProcess webapp.com processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup webapp.com
WSGIScriptAlias / /home/webapp/index.py
import web
urls = (
'/', 'index',
'/test', 'index1'
)
app = web.application(urls, globals(), autoreload=True)
class index:
def GET(self):
return 'hello world!'
class index1:
def GET(self):
return 'hello test!'
application = app.wsgifunc()
if __name__ == "__main__":
app.run()
service apache2 restart