Flask 使用教程
一、环境准备
1、安装Python Linux和Mac 一般自带Python2.6.*版本
2、安装easy_install和pip工具
easy_insall的作用和perl中的cpan,ruby中的gem类似,都提供了在线一键安装模块的傻瓜方便方式,而pip是easy_install的改进版,提供更好的提示信息,删除package等功能。老版本的python中只有easy_install,没有pip
easy_install下载与安装参照
https://pypi.python.org/pypi/setuptools#using-setuptools-and-easyinstall
查看easy_install 使用帮助
easy_install —help
pip下载与安装参照
https://pypi.python.org/pypi/pip
下载:
wget 文件地址
解压:tar -xvf xxx.tar.gz
安装:python setup.py install
3、安装virtualenv
$ sudo pip install virtualenv
使用
$ mkdir myproject
$ cd myproject
$ virtualenv venn
New python executable in venv/bin/python
Installing distribute............done.
现在,只要你想要在某个项目上工作,只要激活相应的环境。在 OS X 和 Linux 下,按如下做:
$ . venv/bin/activate
如果你是个 Windows 用户,下面的命令行是为你准备的:
$ venv\scripts\activate
二、升级Python2.6.* 到Python2.7.*
升级后easy_install 和pip 需要重新安装
三、uWSGI 与Nginx配置 参照
http://www.nowamagic.net/academy/detail/1330331
http://www.phpgao.com/nginx_uwsgi_flask.html
http://www.oschina.net/translate/serving-flask-with-nginx-on-ubuntu
http://www.nginx.cn/591.html