douban / code

[DEPRECATED]Douban CODE

Home Page:http://douban-code.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

code on vagrant CentOS-6.4

freemantjp opened this issue · comments

commented

准备环境vagrant CentOS-6.4-i386-v20130731.box

安装mysql git

yum install update
yum install -y mysql mysql-server mysql-devel git python-devel memcached

安装python2.7

wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2 --no-check-certificate
tar xvf Python-2.7.5.tar.bz2
cd Python-2.7.5
./configure --prefix=/usr/local
make && make altinstall

easy_install包

wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz --no-check-certificate
tar xf distribute-0.6.49.tar.gz
cd distribute-0.6.49
python2.7 setup.py install

必须“python2.7”,否则将安装到默认的2.6环境内。

easy_install virtualenv
easy_install pip

安装memcached libmemcached

pip install mime python-magic
wget https://github.com/xtao/douban-patched/raw/master/libmemcached-douban-1.0.18.tar.gz --no-check-certificate
tar zxf libmemcached-douban-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure && make && sudo make install
ln -s /usr/local/lib/libmemcached.so.11 /usr/lib/libmemcached.so.11

部署code

git clone https://github.com/douban/code.git
cd code
mysql -uroot -e 'create database valentine;'
mysql -uroot -D valentine < vilya/databases/schema.sql
virtualenv venv --python=python2.7
cd venv
source ./bin/activate venv

pip install cython
pip install -U setuptools
easy_install distribute==0.6.28

yum install bzip2-devel
cp /usr/lib/python2.6/lib-dynload/bz2.so /usr/local/lib/python2.7/.

pip install -e "git+https://github.com/qingfeng/misaka.git@2fbe52692e8f304eea9d8925fd2a857916ff0ea5#egg=misaka-1.0.3"

pip install -r requirements.txt

定制 config运行

cp vilya/local_config.py.tmpl vilya/local_config.py

gunicorn -w 2 -b 127.0.0.1:8000 app:app

DOMAIN 是指的是程序运行的域名,包含IP地址和端口,例如: http://127.0.0.1:8000/

👏

整理到 wiki 更合适? https://github.com/douban/code/wiki

commented

wiki最开始打不开,现在ok了,转过去

@freemantjp 我把你添加的页面格式处理了一下, https://github.com/douban/code/wiki/CODE-on-Vagrant-CentOS

🍻

@freemantjp 我有一个小问题

yum install bzip2-devel
 cp /usr/lib/python2.6/lib-dynload/bz2.so /usr/local/lib/python2.7/.

这2句的原因是?

@xtao @liluo 安装python2.7这个应该给用户一些提示,比如系统默认的PATH会优先找新安装的python. 可能会对当前使用的模块以及项目有影响

commented

@dongweiming 貌似requirements.txt里的wsgiauth==0.1等包是bz2格式的,需要安装bz2的lib,或者在编译python2.7的时候加入,不同的系统可能不同,我的是基于vagrant box
http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-i386-v20130731.box

@freemantjp 额 这样啊 我觉得你可以把box的下载地址也列出来. 不同的box可能在定制时就有不同了

安装不了cmemcached,唉

无法理解这种都会有,搞了N久都不行,没见过这么难用的开源!

raceback (most recent call last):
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
import(module)
File "/vagrant/code/app.py", line 5, in
from web import app as web
File "/vagrant/code/web.py", line 11, in
from vilya import views as controllers
File "/vagrant/code/vilya/views/init.py", line 8, in
from vilya.views.organizations import OrganizationUI
File "/vagrant/code/vilya/views/organizations/init.py", line 6, in
from vilya.models.organization import Organization
File "/vagrant/code/vilya/models/organization.py", line 5, in
from vilya.libs.store import OrzField, store, IntegrityError, OrzBase
File "/vagrant/code/vilya/libs/store.py", line 5, in
from ORZ import OrzField, OrzBase, setup
ImportError: cannot import name OrzField
Traceback (most recent call last):
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/vagrant/code/venv/local/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
import(module)
File "/vagrant/code/app.py", line 5, in
from web import app as web
File "/vagrant/code/web.py", line 11, in
from vilya import views as controllers
File "/vagrant/code/vilya/views/init.py", line 8, in
from vilya.views.organizations import OrganizationUI
File "/vagrant/code/vilya/views/organizations/init.py", line 6, in
from vilya.models.organization import Organization
File "/vagrant/code/vilya/models/organization.py", line 5, in
from vilya.libs.store import OrzField, store, IntegrityError, OrzBase
File "/vagrant/code/vilya/libs/store.py", line 5, in
from ORZ import OrzField, OrzBase, setup
ImportError: cannot import name OrzField

@FashtimeDotCom 对于你的无法安装表示抱歉,每个开源项目都会有一些问题,CODE 一开始并不是按照一个开源项目来写的,依赖问题很恼人,我们正在重写,后面会有一个一开始就定位是开源的项目出来。