How-To: Add VirtualEnv and TurboGears2 (WSGI frmwk) to XAMPP

Problems with the Linux version of XAMPP, questions, comments, and anything related.

How-To: Add VirtualEnv and TurboGears2 (WSGI frmwk) to XAMPP

Postby greno » 18. December 2010 20:03

Start by following the How-To: Add Python and mod_wsgi to XAMPP:

You should now have Python and mod_wsgi installed and working in XAMPP.

To create a good Python working environment for XAMPP we need to set some environment variables:
Code: Select all
echo "
export PATH=/opt/lampp/sbin:/opt/lampp/bin:/opt/lampp:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/bin
export PYTHONVERSION=$(/opt/lampp/bin/python -c "import sys;print '%d.%d' % sys.version_info[:2]")
export PYTHONPATH=$(/opt/lampp/bin/python -c "import sys;print ':'.join(sys.path)")
export PYTHONPREFIX=$(/opt/lampp/bin/python -c "import sys;print '%s' % sys.prefix")
" > ~/.bashrc_xampp
# plus I would recommend you add XAMPP into your $PS1 prompt somewhere

Now we source this file into your environment:
Code: Select all
source ~/.bashrc_xampp

To install VirtualEnv in XAMPP:
Code: Select all
 cd /tmp
 wget --content-disposition
 tar xzf virtualenv-1.5.1.tar.gz
 cd virtualenv
 sudo python install
 cd $HOME
 virtualenv --no-site-packages --distribute ENV  # does not use packages from main XAMPP python
 source ENV/bin/activate
   # your command prompt will change to something like this:
  (ENV)[greno@zebra:2 XAMPP virtualenv]$
 Note: deactivate  # when you want to leave ENV

To install TurboGears2 (WSGI-framework), Genshi templates and SQLAlchemy:
Code: Select all
 pip install TurboGears2  Genshi  sqlalchemy

To install the TurboGears2 development tools:
Code: Select all
pip install -i tg.devtools

Now let's create our first TurboGears2 application:
Code: Select all
 mkdir projects
 cd projects/
 paster quickstart HelloWorld
 cd HelloWorld/
 python develop
 paster setup-app development.ini

And let's run the built-in webserver:
Code: Select all
 paster serve --reload development.ini
    Starting subprocess with file monitor
    Starting server in PID 29550.
    serving on http://localhost:8080

browser to: http://localhost:8080




Posts: 54
Joined: 04. October 2006 19:25

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 8 guests