virtual environment etiketli yazı

Preparing virtual environment for running with apache mod_wsgi & postgresql

For completing postgresql requirements of virtual environment, install “libpq-dev” and “python-dev” packages, outside of virtual environment.

$ deactivate (if you are in virtual environment)
$ sudo apt-get install libpq-dev python-dev

Re-activate virtual environment and install psycopg2 from pip repo.

$ pip install psycopg2

By the way, in the name of  conformist approach install ipython in virtual environment.

$ pip install ipython

PostgreSQL engine and python connection libraries are ready.
Now, lets prepare wsgi file for current project. (I assumed apache and mod_wsgi installed and configured) I’m going to use /var/www/project path for example for environment root in wsgi file.

ENV_DIR = [‘/var/www/project’]

import site, os, sys

base = os.path.dirname(__file__)
sys.path.insert(0, base)
...

Devamı...

Installing Django-CMS over Python Virtual Environment on Ubuntu based systems

Prepare for virtual environment:

$ sudo apt-get install python-setuptools python-dev build-essential
$ sudo easy_install pip
$ sudo pip install virtualenv

Creating a virtual environment:

$ virtualenv example_env -p python2.7 –no-site-packages –distribute

Activating virtual environment:

$ source example_env/bin/active

Installing Django and Django-CMS in to virtual environment:

$ pip install PIL
$ pip install django-cms

the command above is also installs those required packages:

django
django-mptt
django-classy-tags
django-sekizai
south
html5lib

Thats all. Library installation on virtual environment is complete. On the next, how to run django-cms on django with apache…

Note: If you want to exit from virtual environment just type this:

$ deactivate

Devamı...