Introduction
The PYGUICMS project should work everywhere Python is installable. This may say that the PYGUICMS should be compatible with almost every most know operating system. Checkout the Python website and look if Python may be installed on your Operating System.
If you have tested the PYGUICMS on another distribution or operating system listed below, please contact us to let it know. It will be interesting to fill more informations about other distributions/operating systems.
License
The PYGUICMS project make use of the GPL version 2 license. See the license file provided with the sources or fetch it from http://www.gnu.org/licenses/gpl-2.0.txt.
Requirements
- An Operating System where Python is installable.
- TurboGears (http://www.turbogears.org)
- SQLObject (http://www.slqobject.org)
- Python Imaging Library (http://www.pythonware.com/products/pil/)
- python-crypto (required for the tgcaptcha)
- TGCaptcha (http://code.google.com/p/tgcaptcha/)
- Database related depending of the used database:
- SQLite - pysqlite1.1 or pysqlite2 depending the used distribution (not needed if python 2.5)
- MySQL - mysqldb
- PostgreSQL - psycopg or psycopg2 depending the used distribution
Installation
Some parts of the setup may be generic and other may be related to the operating system you may use. So lets first start with the installation part. We may ensure that all the requirements are been installed.
Get the informations of the README.txt file
(Debian) GNU/Linux
This may apply to some other GNU/Linux distributions.
On most GNU/Linux distribution you can use a package management tool to install and uninstall packages. Take a look with your package management tool which packages are available.
On Debian you may use the follow command to install the needed package:
aptitude install python-turbogears
There may a need to install a few more packages...
NOTE: The current version 1.0.4.2-1 of the testing branch does not work like expected. Take the older 1.0.3.2-1 version! One of his depencies are broken. If you take the newer version, you will be unable to change (save) any pages! This should be now fixed on Debian, need to track this.
NOTE: The old-stable (Sarge) users: I have not yet get TurboGears working on a Debian Sarge box. There is a little problem with the sqlite version available on Debian Sarge. I guess with other database backends there will be no problem. But i have not yet tested like i make use of sqlite at this stage in the development of this stuff. But i guess that these users have forget to upgrade his box. So, i don't care :-p
You can also make use of the easy_install (included in python-setuptools) to install the most recent stable version. It's *recommended* to use easy_install to install all the pyguicms and TurboGears related stuff. See below how to install all the needed stuff with easy_install.
Install from the TurboGears source
TurboGears has created a little script tgsetup.py to download and install the required software.
Non-root install
The non-root install is only for *nix systems. This way of proceeding permit to install TurboGears on system where you don't have the root rights. This is especially useful for on rented hosting or even at home where you TurboGears version provided with your Linux package manager is out-dated.
mkdir ~/downloads
cd ~/downloads
wget http://peak.telecommunity.com/dist/virtual-python.py
python virtual-python.py
This output:
Creating /home/dvanmosselbeen/lib/python2.4
Creating /home/dvanmosselbeen/lib/python2.4/site-packages
Creating /home/dvanmosselbeen/include/python2.4
Copying /usr/bin/python to /home/dvanmosselbeen/bin
You're now ready to download ez_setup.py, and run
/home/dvanmosselbeen/bin/python ez_setup.py
Go in the new environment:
export PYTHONPATH=/home/dvanmosselbeen/lib/python2.4/site-packages
Download and install setuptools:
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py --script-dir=$HOME/bin
Installing TurboGears:
easy_install --install-dir=/home/dvanmosselbeen/lib/python2.4/site-packages \
--script-dir=/home/dvanmosselbeen/bin "TurboGears==1.0.7"
Installing SQLObject:
easy_install --install-dir=/home/dvanmosselbeen/lib/python2.4/site-packages \
--script-dir=/home/dvanmosselbeen/bin SQLObject
Installing tgcaptcha:
easy_install --install-dir=/home/dvanmosselbeen/lib/python2.4/site-packages \
--script-dir=/home/dvanmosselbeen/bin tgcaptcha
Checkout this articles for more informations here.
MS Windows
The install and setup process differ a little bit on a Microsoft Windows system. That's why i have noted the whole setup here.
I recommend to get the ActivePython from ActiveStates:
Get and install ActivePython-2.5 from http://www.activestate.com/Products/activepython/.
Install Easy_install:
Download the ez_setup.py file from http://peak.telecommunity.com/dist/ez_setup.py and put it somewhere. Open a command line interpreter (aka Command prompt):
python ez_setup.py
Add C:\Python25\Scripts to the PATH variable. For this, right click on My Computer, in the tab Advanced and click on the button Environment Variables. Edit the Path variable and append C:\Python25\Scripts. Use ; as path separator.
Install TurboGears and requirements:
Close the previous command line interpreter (aka Command prompt) and open a new command line interpreter (aka Command prompt) to take the new changes in effect.
easy_install turbogears easy_install sqlobject easy_install pil easy_install tgcaptcha
The tgcaptcha install will fails on the pycrypto depency, it complains about the Visual Studio version 7.1 missing.
Download, extract and install the exe from http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?file=psyco-1.5.1.win32-py2.5.zip.
Download the PYGUICMS files, checkout the PyguicmsDownload. Extract the stuff somewhere and in a DOS prompt go to the location where you have extracted the files.
Copy the dev.cfg.sample config file to dev.cfg.
Create now the database and his tables with the default values:
tg-admin sql create python setup_db.py --verbose --mode=dev --start
Start now the stuff:
python start_pyguicms.py
You can now point your browser to http://localhost:7010/.
Configuration
- Remove or better, rename the setup.py to setup.py_ORG if you want to make use of the production mode.
- Copy an environment config file dev.cfg.sample or prod.cfg.sample. You should first start with the development version to ensure if everything is been ok. So copy dev.cfg.sample to dev.cfg.
- Edit the dev.cfg or prod.cfg file depending of your choice and read the comments in there. This configuration file is self explaining and should be not a problem to define the different options.
- Tweak the conf/app.cfg. This file has enough comments.
- Execute the start_pyguicms.py without an argument that define the type of environment and this will make use of the dev.cfg configuration file if there's no prod.cfg configuration file found.
With the type of environment i mean the development or the production server. The development spawn some information to the console and is much more slower as the production environment. The development is intended for what this mean. Only people who is working on the code may need this environment. So that the code will be reloaded when some changes are made on the code. As default, the dev.cfg configuration file will be used.
Setup the database
Once that everything is been setup, you may need to add the default data. The default data is the permissions, groups, users, pages, ... This is a required step!
If you make use of MySQL you may need to create the database by the hand and create a special user reserved for this database. Give that user only rights for the pyguicms database and don't user your root or administrator account of MySQL!
To put the default data into the database run the following script in the directory containing the pyguicms files:
python setup_db.py --verbose --mode=dev --start
The --mode=<environment> define the environment to setup. This is in most of the case a different database.
Deployment
The pyguicms should be run with various webserver. Actually, only informations for apache2 is provided. Don't hesitate to contact us if you have setup the pyguicms project on another webserver.
Using the build-in web server
This little webserver is able to handle around 1000 requests seconds. In the most cases, this build-in webserver is more as enough for some littler projects. Where there are not that much visitors at the same time.
Start the script as following:
./start_pyguicms.py
Or on Microsoft Windows operating systems:
python start_pyguicms.py
Apache2 web server
See the info on TurboGears.
The info come from here. Thank you very much for this info! It was pain in the ass to get my project running with Apache without your tricks!
Install the required stuff:
aptitude install apache2
aptitude install libapache2-mod-proxy-html
Load the needed apache modules:
a2enmod proxy a2enmod proxy_http
Create a new file at:
/etc/apache2/conf.d/pyguicms
and put the following:
ProxyPreserveHost on <Proxy *> Order allow,deny Allow from all </Proxy> ProxyPass /pyguicms/ http://127.0.0.1:8080/pyguicms/ ProxyPassReverse /pyguicms/ http://127.0.0.1:8080/pyguicms/ ProxyPass /static/ http://127.0.0.1:8080/static/ ProxyPassReverse /static/ http://127.0.0.1:8080/static/
Now, force the reload of the apache config:
/etc/init.d/apache2 force-reload
Start the pyguicms project:
./start_pyguicms.py
Lighttpd web server
See the info on about running TurboGears on lighttp.
...
