Document directory
- 1. Prepare the environment
- 2. Set the virtual environment and install tg21
1. Prepare the environment
In centos 5.x Linux, Python 2.4 has been installed by default. Therefore, we will install turbogears 2.1 on this basis.
At the time of writing this article, the latest tg21 version is RC1. We will install it on this basis.
Install easy_install first. We recommend that you use the latest version above pypi.python.org. Do not use yum for installation. The built-in centos version is relatively low.
Download easy_install 0.6c11 with wget:
$ Wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c11-py2.4.egg#md5=bd639f9b0eac4c42497034dec2ec0c2b
Then run sh to execute the downloaded. Egg file:
$ Sh./setuptools-0.6c11-py2.4.egg
This completes the installation of setuptools.
Next, we will install a virtualenv software. This software can construct a virtual Python environment and install the third-party software packages downloaded during turbogears installation to this virtual environment without affecting the system environment. You can also create multiple virtual environments and try different third-party software packages in different environments.
Install virtualenv directly with easy_install.
$ Easy_install virtualenv
Now, the environment required for installation is ready.
2. Set the virtual environment and install tg21
Use virtualenv to create a virtual environment, and then install turbogears 2.1 in the virtual environment
$ Virtualenv -- no-site-packages tg21env
$ CD tg21env/
$ Source bin/activate
(Tg21env) $ easy_install hashlib pysqlite UUID functools
(Tg21env) $ easy_install-u beaker
(Tg21env) $ easy_install-I http://www.turbogears.org/2.1/downloads/current/index TG. devtools
(Tg21env) $ Paster Quickstart example
(Tg21env) $ CD example/
(Tg21env) $ Python setup. py develop
(Tg21env) $ nosetests
(Tg21env) $ Paster setup-app development. ini
(Tg21env) $ Paster serve development. ini
Open your browser and enter http: // 127.0.0.1: 8080 in the address bar.
Installed successfully!
If you want to access this test server from another computer, modify the development. ini in the example directory and set the host value to 0.0.0.0 in [server: Main.
If you want to exit from the virtual environment, type:
(Tg21env) $ deactivate
You can.