1. insall epel (ref-link)
2. install erlang
#yum install erlang
3. install rabbitmq
a. download rabbitmq rpm (link)
b. install:
#rpm -Uvh rabbitmq-xxxx.rpm
c. let rabbitmq daemon auto-start on boot up:
#chkconfig rabbitmq-server on
d. start rabbitmq server:
#service rabbitmq-server start
4. install Celery
#easy_install Celery
5. install django-celery
#easy_install django-celery
6. setting up django-celery on project (link)
個人在學習Linux過程當中的個人筆記,提供個人及有需要的人查閱,若有錯誤歡迎提供指正,謝謝。 This Blog recorded notes about my learning Linux and provides myself and others reference. If there are any incorrect information, welcome to leave a message to correct me, Thanks.
2012年1月6日 星期五
2011年12月29日 星期四
using mod_wsgi deploy django project
1. install httpd-devel, python-devel
# yum install htppd-devel, python-devel
2. install mod_wsgi
a. Download mod_wsgi source code. modwsgi
b. untar & using ./configure; make; make install
3. edit /etc/httpd/conf/httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /mysite /usr/local/www/mysite/apache/django.wsgi
4. Create django project
#cd /usr/local/www
#django-admin.py startproject mysite
5. create apache folder
# cd /usr/loca/www/mysite
# mkdir apache
6. Create django.wsgi file in apache folder, the content is:
7. restart httpd
8. open brower and open link: http://localhost/mysite
Reference:
http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/
# yum install htppd-devel, python-devel
2. install mod_wsgi
a. Download mod_wsgi source code. modwsgi
b. untar & using ./configure; make; make install
3. edit /etc/httpd/conf/httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /mysite /usr/local/www/mysite/apache/django.wsgi
4. Create django project
#cd /usr/local/www
#django-admin.py startproject mysite
5. create apache folder
# cd /usr/loca/www/mysite
# mkdir apache
6. Create django.wsgi file in apache folder, the content is:
import os
import sys
path = '/usr/local/www'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
7. restart httpd
8. open brower and open link: http://localhost/mysite
Reference:
http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/
2011年12月22日 星期四
python with statement
python 2.5支援with statement,用法像這樣,以open file為例:
若自定class implement __enter__(self)和__exit__(self, type, value, traceback)也能利用with statement來簡化
參考資料:
http://effbot.org/zone/python-with-statement.htm
http://effbot.org/pyref/with.htm
printf("xxxx");
with open("x.txt") as f:
data = f.read()
do something with data
因為file object已經有了__enter__()和__exit__()這兩個method,利用with statement就能自動達到像是try-except-finally的程式流程若自定class implement __enter__(self)和__exit__(self, type, value, traceback)也能利用with statement來簡化
參考資料:
http://effbot.org/zone/python-with-statement.htm
http://effbot.org/pyref/with.htm
2011年12月21日 星期三
解決yum update perl conflict問題
若yum update perl發生
conflicts with file from package perl.x.x.x
用rpm -e移除perl.i386 (若妳的CentOS是x64)
rpm -e perl.i386
在執行yum update perl應該就不會發生conflicts了
參考資料:
http://slash4.de/tutorials/CentOS_5.4_perl_update_problem
conflicts with file from package perl.x.x.x
用rpm -e移除perl.i386 (若妳的CentOS是x64)
rpm -e perl.i386
在執行yum update perl應該就不會發生conflicts了
參考資料:
http://slash4.de/tutorials/CentOS_5.4_perl_update_problem
2011年11月30日 星期三
vsftpd ipv6 setup
讓vsftpd service 可用ipv6 address連線 (環境: CentOS 5.X)
1. 編輯 /etc/vsftpd/vsftpd.conf
listen=NO #關掉ipv4-only sockets
listen_ipv6=YES #打開ipv4 ipv6相容的模式
2. restart vsftpd
# service vsftpd restart
1. 編輯 /etc/vsftpd/vsftpd.conf
listen=NO #關掉ipv4-only sockets
listen_ipv6=YES #打開ipv4 ipv6相容的模式
2. restart vsftpd
# service vsftpd restart
2011年11月2日 星期三
linux bash getopt
getopt 是 shell 裡抓參數的好工具
例: getopt abc:d: 容許參數 -a -b -c -d, -c and -d 後面要接參數
#!/bin/sh
set - `getopt abc:d: $*`
while true; do
case $1 in
-a) echo option -a
shift ;;
-b) echo option -b
shift ;;
-c) echo option -c=$2
shift 2 ;;
-d) echo option -d=$2
shift 2 ;;
--) shift
break ;;
*) echo "error!"
exit 1 ;;
esac
done
執行結果
# ./go -a
option a
# ./go -c jack
option -c=jack
# ./go -b -c jack
option -b
option -c=jack
# ./go -b -c test -d
getopt: option requires an argument -- d
option -b
option -c=test
(使用後面要加參數的 option 會提示)
# ./go -b -c test -f
getopt: invalid option -- f
option -b
option -c=test
(使用未支援的參數會提示)
http://pank.org/blog/2004/05/getopt-example.html
python join
把string的list join成一個string
tmp = ["a", "b", "c", "d"]
" ".join(tmp)
a b c d
http://stackoverflow.com/questions/3627270/python-how-exactly-can-you-take-a-string-split-it-reverse-it-and-join-it-back
訂閱:
文章 (Atom)