一,环境Ubuntu操作系统
sudo apt-get install update
sudo apt-get install python
二,python扩展包
在python中可以使用easy_install和pip安装python拓展但推荐使用pip,在stackoverflow看到
个帖子:
Don't use easy_install, unless you like stabbing yourself in the face. Use pip.
Two reasons, there may be more:
pip provides an uninstall command
if an installation fails in the middle, pip will leave you in a clean state.
安装pip的方法:
Install pip and virtualenv for Ubuntu 10.10 Maverick and newer
$ sudo apt-get install python-pip python-dev build-essential
$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv
For older versions of Ubuntu
Install Easy Install
$ sudo apt-get install python-setuptools python-dev build-essential
Install pip
$ sudo easy_install pip
Install virtualenv
$ sudo pip install --upgrade virtualenv
三,安装django
pip install django
四,安装mysql
apt-get install mysql-server
apt-get install libmysqld-dev
apt-get install libmysqlclient-dev
python的mysql扩展包
sudo pip install mysql-python
五,安装memcached
sudo apt-get install memcached
apt-get install python-memcache
启动
memcached -uroot -m1024 -t8 -c10240 -p11211 -d
memcached -uroot -d p11215
memcached -d p11215
启动
# /usr/local/bin/memcached -d -m 2048 -u root -l 192.168.1.20 -p 12111 -c 1024 -P /tmp/memcached.pid
facebook例子
/usr/local/bin/memcached -uroot -m 1024 -t 8 -d -c 10240 -p 11212
参数说明:
-d 启动为守护进程
-m <num> 分配给Memcached使用的内存数量,单位是MB,默认为64MB
-u <username> 运行Memcached的用户,仅当作为root运行时
-l <ip_addr> 监听的服务器IP地址,默认为环境变量INDRR_ANY的值
-p <num> 设置Memcached监听的端口,最好是1024以上的端口
-c <num> 设置最大并发连接数,默认为1024
-P <file> 设置保存Memcached的pid文件,与-d选择同时使用
-t <num> number of threads to use (default: 4)
还有一些参数具体请参考:
引用
# /usr/local/bin/memcached -h
结束
# kill `/tmp/memcached.pid`
六,安装NGINX
apt-get install nginx
apt-get install flup
操作见cnblog博客
简单的例子,测试GMO的配置
server {
listen 80;
server_name test-gmo.paopaoyu.cn;
location /ppy_media/ {
root /usr/local/nginx/html/gmo;
}
location / {
fastcgi_pass 127.0.0.1:8180;
fastcgi_buffers 16 16k;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors on;
}
}
七,安装svn
apt-get install subversion
八,代码
python manage.py runfcgi host=127.0.0.1 port=8000 daemonize=true