How-To: Add VirtualEnv and Pylons (WSGI framework) to XAMPP

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

How-To: Add VirtualEnv and Pylons (WSGI framework) to XAMPP

Postby greno » 06. December 2010 04:31

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 Pylons (WSGI-framework) and SQLAlchemy:
Code: Select all
 pip install pylons sqlalchemy

Now let's create our first Pylons application:
Code: Select all
 mkdir projects
 cd projects/
 paster create --template=pylons HelloWorld

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:5000

browser to: http://localhost:5000




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

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 7 guests