ubuntu+uwsgi+nginx+django手记

2015-12-08 10:39:00

下面的安装都没测试,都是靠记忆,要是出问题我不负责

我只是因为AWS免费套餐到期,把里面的配置文件拉出来备份下

sudo apt-get install nginx
sudo apt-get install python-dev
sudo apt-get install uwsgi
sudo apt-get install uwsgi-plugin-python

uwsgi 测试

uwsgi --http-socket :9090 --plugin python --wsgi-file XXXX.py --process 3

各种配置文件链接

ln -s /home/XX/XX/XX/uwsgi.ini /etc/uwsgi/apps-enabled/

nginx同理

nginx配置

server {
    listen      80;
    server_name xx.xx.xx.xx;
    access_log  /home/ubuntu/nginx_conf/log/access.log;
    error_log   /home/ubuntu/nginx_conf/log/error.log;

    location /static {
        alias /home/xx/xx/xx/project/static;
    }

    location /test { #test去掉就是根目录
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:9090;
        uwsgi_param UWSGI_SCRIPT django_wsgi;
        uwsgi_param SCRIPT_NAME /test;# test..
        uwsgi_modifier1 30;
        proxy_read_timeout 300;
        proxy_connect_timeout 300;
        proxy_redirect off;
    }
}

uwsgi配置

[uwsgi]
chdir           = /home/xx/project
module          = projectname.wsgi:application
master          = true
socket          = 127.0.0.1:9090
plugin          = python
process         = 4
chmod-socket    = 666
buffer-size     = 49152
threads         = 2
max-requests    = 6000
vacuum          = true
daemonize       = /home/xx/xx/xx/uwsgi.log
技术  django nginx python ubuntu uwsgi
 

长大的龙们(附:Flight Rising一些资料整理)

2015-11-29 21:26:00

在玩了几天过后,一些在刚开始两天从市场带回来的小龙都长大了,有些出落得愈发标致/帅气,有些就有点……

硝基

游戏  FR
 

ubuntu清理boot分区

2015-11-25 19:19:00

因为这个事情做了太多了,每次都去百度查觉得自己太那啥了。

不过这次我不是因为boot空间不足才做的,是因为从64开始的所有内核都不好用,都说找不到主磁盘这是什么鬼???

STEP1,获取所有安装的内核

dpkg --get-selections|grep linux-image
linux-image-3.13.0-62-generic           install
linux-image-3.13.0-63-generic           install
linux-image-3.13.0-65-generic           install
linux-image-3.13.0-66-generic           install
linux-image-3.13.0-67-generic           install
linux-image-3.13.0-68-generic           install
linux-image-extra-3.13.0-62-generic     install
linux-image-extra-3.13.0-63-generic     install
linux-image-extra-3.13.0-65-generic     install
linux-image-extra-3.13.0-66-generic     install
linux-image-extra-3.13.0-67-generic     install
linux-image-extra-3.13.0-68-generic     install
linux-image-generic             install

step2,查看当前使用的内核

uname -a
Linux jiyou-ThinkPad-X240 3.13.0-63-generic #103-Ubuntu SMP Fri Aug 14 21:42:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

step3-N,卸载不要的内核

sudo apt-get purge linux-image-3.13.0-68-generic 
sudo apt-get purge linux-image-3.13.0-67-generic 
sudo apt-get purge linux-image-3.13.0-66-generic 
sudo apt-get purge linux-image-3.13.0-65-generic 

stepN+1,我是不是应该重启一下机器了?

技术  linux ubuntu
 

Flight Rising

2015-11-24 21:07:00

最近在继续用bootstrap渲染这里,闲暇的时候以前C世界的老盆友给推荐了个养龙的页游,给了我很大的惊喜。可能说我比较中意这种类型的游戏。

Flight Rising

游戏  FR 评论 
 

生命游戏

2015-08-26 13:22:00

从开始写代码就乐此不疲的一个项目

100阶段的随机250X250生命游戏

技术  css python
 

Civitas广场数据

2015-06-12 16:23:00
技术  bigdata civitas
 

Civitas广场演讲大数据(~D802)

2015-06-02 13:41:00

这货很早以前就玩过一次,还是比较有趣

6/4 python版本 更新

数据截止到D804

代码点我

基本上就是这么回事,用urllib2爬,用BeautifulSoup拆,依赖项是xlwt和bt4(和附近的mccblackteck)

pip install xlwt
pip install beautifulsoup4

比较恶心的问题是:

  1. 代码丑,不解释
  2. 因为soup经常抓错,所以用了吓死人的while True去抓到可以为止,没设次数,所以要是永远抓不到就没有结束的时候了
  3. xlwt操作excel是xls,只能65535行,所以加了sheet 0,1,2….

分布图

技术  bigdata civitas