we recommend using isolated python enviroment, using pythonbrew
. you can find it here. through the following commands, you are good to go.
install pythonbrew
.
$ curl -kL http://xrl.us/pythonbrewinstall | bash
add this to your ~/.bashrc
.
[[ -s $HOME/.pythonbrew/etc/bashrc ]] && source $HOME/.pythonbrew/etc/bashrc
after that, reload your shell env and install the required python version.
$ source /etc/profile
$ pythonbrew install 2.7.3
make sure you have easy_install
or pip
installed. in the most case if you use pythonbrew
, they're already installed. Or you can install by yourself.
$ apt-get install python-setuptools
$ apt-get install python-pip
run following command to install the project dependencies.
$ python setup.py install
or download flowing packages manually:
- memcache client: http://pypi.python.org/pypi/python-memcached/1.48
- flask : http://flask.pocoo.org/
- oursql: mysql client for python. In ubuntu, you can install use "sudo apt-get install libmysqlclient-dev python-dev && sudo pip install oursql"
- SQLAlchemy: Database Abstract Layer. In ubuntu, you can install use "sudo pip install SQLAlchemy"
memcache-cloud using different config for different enviroment such as production
and development
. here is how it works
-
a file named
env.py
with content likeENV="ProductionConfig"
specified the enviroment. -
memcache-cloud judging from a config named 'ENV' to load the according config from a file named
config.py
in the root directory of the project.ENV="Development" class Config(object): HOST='0.0.0.0' PORT=8818 class ProductionConfig(Config): DEBUG=False class DevelopmentConfig(Config): PORT=3000 DEBUG=True
-
config database in env.py.
class DevelopmentConfig(Config): PORT=3000 DEBUG=True DB_URI="mysql+oursql://mc:mc@localhost/mc"
2.run the initdb.py
```
$ python initdb.py
```