{"node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "revisions": [{"id": "f28ce6f2-2f95-11f1-857e-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv Apache2 mod_wsgi\r\n===============================================\r\n \r\n By the end of this article you will know how to deploy a Django web application using a python virtualenv, using an Apache2 webserver with mod_wsgi.\r\n\r\n You should bookmark this page.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is fast.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools memcached\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South python-memcached\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use.  Also configure memcached:\r\n   \r\n   .. code-block :: python\r\n \r\n    # database settings\r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n    # memcached settings (osqa is slow as dirt without this)\r\n    CACHE_BACKEND = 'memcached://127.0.0.1:11211/'\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-available vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-available/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n     #lostquery.com\r\n\r\n     #Djangos embeded mod_wsgi\r\n     <VirtualHost *:80>\r\n          ServerName lostquery.com\r\n          ServerAlias www.lostquery.com\r\n          ServerAdmin admin@admin.com\r\n\r\n          # ReWrite URL to WWW\r\n          RewriteEngine On\r\n          RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n          RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n          # Log Files\r\n          ErrorLog /var/log/apache2/error-lostquery.log\r\n          CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n          # Prevent django from serving static files\r\n          DocumentRoot /www/lostquery.com/trunk/forum\r\n          Alias /m/ /www/lostquery.com/trunk/forum/skins/\r\n          Alias /upfiles/ /www/lostquery.com/trunk/forum/upfiles/\r\n          <Directory /www/lostquery.com/trunk/forum/skins>\r\n              Order allow,deny\r\n              Allow from all\r\n          </Directory>\r\n\r\n          # Setup mod_wsgi\r\n          WSGIDaemonProcess lostquery display-name=lostquery user=www-data processes=2 threads=15\r\n          WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n     </VirtualHost>\r\n\r\n\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nEnable the Virtual Host and reload Apache2\r\n------------------------------------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2ensite lostquery\r\n\r\n    $ sudo service apache2 reload\r\n\r\n", "source_format": "rst", "revision_number": 20, "created": 1354992446000}, {"id": "f28ce06c-2f95-11f1-91ea-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv Apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools memcached\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South python-memcached\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use.  Also configure memcached:\r\n   \r\n   .. code-block :: python\r\n \r\n    # database settings\r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n    # memcached settings (osqa is slow as dirt without this)\r\n    CACHE_BACKEND = 'memcached://127.0.0.1:11211/'\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-available vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-available/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n     #lostquery.com\r\n\r\n     #Djangos embeded mod_wsgi\r\n     <VirtualHost *:80>\r\n          ServerName lostquery.com\r\n          ServerAlias www.lostquery.com\r\n          ServerAdmin admin@admin.com\r\n\r\n          # ReWrite URL to WWW\r\n          RewriteEngine On\r\n          RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n          RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n          # Log Files\r\n          ErrorLog /var/log/apache2/error-lostquery.log\r\n          CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n          # Prevent django from serving static files\r\n          DocumentRoot /www/lostquery.com/trunk/forum\r\n          Alias /m/ /www/lostquery.com/trunk/forum/skins/\r\n          Alias /upfiles/ /www/lostquery.com/trunk/forum/upfiles/\r\n          <Directory /www/lostquery.com/trunk/forum/skins>\r\n              Order allow,deny\r\n              Allow from all\r\n          </Directory>\r\n\r\n          # Setup mod_wsgi\r\n          WSGIDaemonProcess lostquery display-name=lostquery user=www-data processes=2 threads=15\r\n          WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n     </VirtualHost>\r\n\r\n\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nEnable the Virtual Host and reload Apache2\r\n------------------------------------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2ensite lostquery\r\n\r\n    $ sudo service apache2 reload\r\n\r\n", "source_format": "rst", "revision_number": 19, "created": 1341522249000}, {"id": "f28cdafa-2f95-11f1-8440-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv Apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools memcached\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South python-memcached\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use.  Also configure memcached:\r\n   \r\n   .. code-block :: python\r\n \r\n    # database settings\r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n    # memcached settings (osqa is slow as dirt without this)\r\n    CACHE_BACKEND = 'memcached://127.0.0.1:11211/'\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-available vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-available/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n     #lostquery.com\r\n\r\n     #Djangos embeded mod_wsgi\r\n     <VirtualHost *:80>\r\n          ServerName lostquery.com\r\n          ServerAlias www.lostquery.com\r\n          ServerAdmin admin@admin.com\r\n\r\n          # ReWrite URL to WWW\r\n          RewriteEngine On\r\n          RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n          RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n          # Log Files\r\n          ErrorLog /var/log/apache2/error-lostquery.log\r\n          CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n          # prevent django from seting static files\r\n          DocumentRoot /www/lostquery.com/trunk/forum\r\n          Alias /m/ /www/lostquery.com/trunk/forum/skins/\r\n          Alias /upfiles/ /www/lostquery.com/trunk/forum/upfiles/\r\n          <Directory /www/lostquery.com/trunk/forum/skins>\r\n              Order allow,deny\r\n              Allow from all\r\n          </Directory>\r\n\r\n          # Setup mod_wsgi\r\n          WSGIDaemonProcess lostquery display-name=lostquery user=www-data processes=2 threads=15\r\n          WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n     </VirtualHost>\r\n\r\n\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nEnable the Virtual Host and reload Apache2\r\n------------------------------------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2ensite lostquery\r\n\r\n    $ sudo service apache2 reload\r\n\r\n", "source_format": "rst", "revision_number": 18, "created": 1317329911000}, {"id": "f28cd620-2f95-11f1-b648-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv Apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools memcached\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South python-memcached\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use.  Also configure memcached:\r\n   \r\n   .. code-block :: python\r\n \r\n    # database settings\r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n    # memcached settings (osqa is slow as dirt without this)\r\n    CACHE_BACKEND = 'memcached://127.0.0.1:11211/'\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-available vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-available/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n     #lostquery.com\r\n\r\n     #Djangos embeded mod_wsgi\r\n     <VirtualHost *:80>\r\n          ServerName lostquery.com\r\n          ServerAlias www.lostquery.com\r\n          ServerAdmin admin@admin.com\r\n\r\n          # ReWrite URL to WWW\r\n          RewriteEngine On\r\n          RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n          RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n          # Log Files\r\n          ErrorLog /var/log/apache2/error-lostquery.log\r\n          CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n          # prevent django from seting static files\r\n          DocumentRoot /www/lostquery.com/trunk/forum\r\n          Alias /m/ /www/lostquery.com/trunk/forum/skins/\r\n          Alias /upfiles/ /www/lostquery.com/trunk/forum/upfiles/\r\n          <Directory /www/lostquery.com/trunk/forum/skins>\r\n              Order allow,deny\r\n              Allow from all\r\n          </Directory>\r\n\r\n          # Setup mod_wsgi\r\n          WSGIDaemonProcess lostquery display-name=lostquery user=www-data processes=2 threads=15\r\n          WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n     </VirtualHost>\r\n\r\n\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nRestart Apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 reload\r\n\r\n", "source_format": "rst", "revision_number": 17, "created": 1317329836000}, {"id": "f28cce60-2f95-11f1-8695-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "f24234f2-2f95-11f1-8a18-e86a64d24d78", "author": "fritzvd", "data": "Django virtualenv Apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools memcached\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South python-memcached\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use.  Also configure memcached:\r\n   \r\n   .. code-block :: python\r\n \r\n    # database settings\r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n    # memcached settings (osqa is slow as dirt without this)\r\n    CACHE_BACKEND = 'memcached://127.0.0.1:11211/'\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n     #lostquery.com\r\n\r\n     #Djangos embeded mod_wsgi\r\n     <VirtualHost *:80>\r\n          ServerName lostquery.com\r\n          ServerAlias www.lostquery.com\r\n          ServerAdmin admin@admin.com\r\n\r\n          # ReWrite URL to WWW\r\n          RewriteEngine On\r\n          RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n          RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n          # Log Files\r\n          ErrorLog /var/log/apache2/error-lostquery.log\r\n          CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n          # prevent django from seting static files\r\n          DocumentRoot /www/lostquery.com/trunk/forum\r\n          Alias /m/ /www/lostquery.com/trunk/forum/skins/\r\n          Alias /upfiles/ /www/lostquery.com/trunk/forum/upfiles/\r\n          <Directory /www/lostquery.com/trunk/forum/skins>\r\n              Order allow,deny\r\n              Allow from all\r\n          </Directory>\r\n\r\n          # Setup mod_wsgi\r\n          WSGIDaemonProcess lostquery display-name=lostquery user=www-data processes=2 threads=15\r\n          WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n     </VirtualHost>\r\n\r\n\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nRestart Apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 reload\r\n\r\n", "source_format": "rst", "revision_number": 16, "created": 1317267827000}, {"id": "f241458d-2f95-11f1-a09c-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv Apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools memcached\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South python-memcached\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use.  Also configure memcached:\r\n   \r\n   .. code-block :: python\r\n \r\n    # database settings\r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n    # memcached settings (osqa is slow as dirt without this)\r\n    CACHE_BACKEND = 'memcached://127.0.0.1:11211/'\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n     #lostquery.com\r\n\r\n     #Djangos embeded mod_wsgi\r\n     <VirtualHost *:80>\r\n          ServerName lostquery.com\r\n          ServerAlias www.lostquery.com\r\n          ServerAdmin admin@admin.com\r\n\r\n          # ReWrite URL to WWW\r\n          RewriteEngine On\r\n          RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n          RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n          # Log Files\r\n          ErrorLog /var/log/apache2/error-lostquery.log\r\n          CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n          # prevent django from seting static files\r\n          DocumentRoot /www/lostquery.com/trunk/forum\r\n          Alias /m/ /www/lostquery.com/trunk/forum/skins/\r\n          Alias /upfiles/ /www/lostquery.com/trunk/forum/upfiles/\r\n          <Directory /www/lostquery.com/trunk/forum/skins>\r\n              Order allow,deny\r\n              Allow from all\r\n          </Directory>\r\n\r\n          # Setup mod_wsgi\r\n          WSGIDaemonProcess lostquery display-name=lostquery user=www-data processes=2 threads=15\r\n          WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n     </VirtualHost>\r\n\r\n\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nRestart Apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 15, "created": 1309134770000}, {"id": "f241414c-2f95-11f1-b236-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv Apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools memcached\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South python-memcached\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use.  Also configure memcached:\r\n   \r\n   .. code-block :: python\r\n \r\n    # database settings\r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n    # memcached settings (osqa is slow as dirt without this)\r\n    CACHE_BACKEND = 'memcached://127.0.0.1:11211/'\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nRestart Apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 14, "created": 1309133615000}, {"id": "f2413d68-2f95-11f1-a28a-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv Apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use:\r\n   \r\n   .. code-block :: python\r\n \r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nRestart Apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 13, "created": 1303939136000}, {"id": "f24138a7-2f95-11f1-9e8b-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use:\r\n   \r\n   .. code-block :: python\r\n \r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nRestart Apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 12, "created": 1303939107000}, {"id": "f24134af-2f95-11f1-8151-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nInstall virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate a virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South\r\n\r\n\r\nInstall and configure the Django web application\r\n----------------------------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use:\r\n   \r\n   .. code-block :: python\r\n \r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nConfigure Apache2 VirtualHost\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\nConfigure mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nReset apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 11, "created": 1303939079000}, {"id": "f241305b-2f95-11f1-9abd-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nSetup virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South\r\n\r\n\r\nSetup Django web application\r\n-------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use:\r\n   \r\n   .. code-block :: python\r\n \r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nSetup Apache2 \r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\nSetup mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nReset apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 10, "created": 1303938827000}, {"id": "f2412be7-2f95-11f1-82bf-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nSetup virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South\r\n\r\n\r\nSetup Django web application\r\n-------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use:\r\n   \r\n   .. code-block :: python\r\n \r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nSetup Apache2 \r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n    :linenos:\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\nSetup mod_wsgi\r\n--------------------------------\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nReset apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 9, "created": 1303938764000}, {"id": "f24127cb-2f95-11f1-a87d-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nSetup virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South\r\n\r\n\r\nSetup Django web application\r\n-------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use:\r\n   \r\n   .. code-block :: python\r\n \r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nSetup Apache2 and mod_wsgi\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nReset apache2\r\n--------------------\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 8, "created": 1303938455000}, {"id": "f24123c4-2f95-11f1-8d11-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nSetup virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South\r\n\r\n\r\nSetup Django web application\r\n-------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use:\r\n   \r\n   .. code-block :: python\r\n \r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_.\r\n\r\n   Let the django application build the tables in the new database:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nSetup Apache2 and mod_wsgi\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nReset apache2\r\n=================\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 7, "created": 1303938398000}, {"id": "f2411f8b-2f95-11f1-939e-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nSetup virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South\r\n\r\n\r\nSetup Django web application\r\n-------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use:\r\n   \r\n   .. code-block :: python\r\n \r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nSetup Apache2 and mod_wsgi\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nReset apache2\r\n=================\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 6, "created": 1289340741000}, {"id": "f2411baf-2f95-11f1-9f56-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": null, "author": null, "data": "cyYtPp  <a href=\"http://otzgpccbdlci.com/\">otzgpccbdlci</a>, [url=http://ibjrwibeaszi.com/]ibjrwibeaszi[/url], [link=http://fyflcwvhthyq.com/]fyflcwvhthyq[/link], http://batxicnswtea.com/", "source_format": "rst", "revision_number": 5, "created": 1289299539000}, {"id": "f24117ce-2f95-11f1-baeb-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": null, "author": null, "data": "cyYtPp  <a href=\"http://otzgpccbdlci.com/\">otzgpccbdlci</a>, [url=http://ibjrwibeaszi.com/]ibjrwibeaszi[/url], [link=http://fyflcwvhthyq.com/]fyflcwvhthyq[/link], http://batxicnswtea.com/", "source_format": "rst", "revision_number": 4, "created": 1289299537000}, {"id": "f2411376-2f95-11f1-8b6f-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": null, "author": null, "data": "gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/", "source_format": "rst", "revision_number": 3, "created": 1289287303000}, {"id": "f2410e1a-2f95-11f1-b16b-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": null, "author": null, "data": "gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/gXYsGz  <a href=\"http://hmtoqnmakhqx.com/\">hmtoqnmakhqx</a>, [url=http://qxkomvqdfnbn.com/]qxkomvqdfnbn[/url], [link=http://wdkfimxrmaiy.com/]wdkfimxrmaiy[/link], http://nihzxpbxowui.com/", "source_format": "rst", "revision_number": 2, "created": 1289287296000}, {"id": "f2410687-2f95-11f1-a41a-e86a64d24d78", "node_id": "f240510a-2f95-11f1-9afc-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Django virtualenv apache2 mod_wsgi\r\n===============================================\r\n\r\n Steps taken to deploy a Django web application (osqa.net) in a virtualenv, using apache2, and mod_wsgi.\r\n\r\n**Why use wsgi and virtualenv?**\r\n\r\n * I also host pylons applications using mod_wsgi and apache2 and mod_python is incompatible.\r\n * mod_wsgi is faster.\r\n * I don't want my public site-packages library conflicting with other applications.\r\n\r\n.. contents::\r\n\r\n\r\nSetup virtualenv\r\n------------------\r\n\r\n#. Install Setup tools:\r\n \r\n   .. code-block :: bash \r\n\r\n    $ sudo apt-get install python-setuptools\r\n\r\n#. Install virtualenv:\r\n\r\n   .. code-block :: bash \r\n\r\n    $ sudo easy_install virtualenv\r\n\r\n\r\nCreate virtualenv\r\n---------------------\r\n#. Move to the directory where you want to create the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ cd /www/lostquery.com\r\n\r\n\r\n#. Create python environment:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ virtualenv --no-site-packages virtpy\r\n\r\n\r\n\r\nInstall Django\r\n----------------\r\n\r\n#. Activate the virtualenv:\r\n     \r\n   .. code-block :: bash\r\n\r\n    $ source virtpy/bin/activate\r\n\r\n#. The shell should have changed to *(virtpy) $* .  Run this command to install django to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install django\r\n\r\n#. Install any dependencies you will need to the virtualenv:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ easy_install MySQL-python markdown html5lib modwsgideploy python-openid South\r\n\r\n\r\nSetup Django web application\r\n-------------------------------\r\n\r\n#. Get the sourcecode:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ svn co http://svn.osqa.net/svnroot/osqa/trunk\r\n\r\n#. Configure the application:\r\n    \r\n   .. code-block :: bash\r\n\r\n    $ cd trunk\r\n\r\n    $ cp settings_local.py.dist settings_local.py\r\n\r\n    $ vi settings_local.py\r\n\r\n#. You must tell the Django's application what database to use:\r\n   \r\n   .. code-block :: python\r\n \r\n    DATABASE_NAME     =  'databasename' # Or path to database file if using sqlite3.\r\n    DATABASE_USER     =  'username'     # Not used with sqlite3.\r\n    DATABASE_PASSWORD =  'p@ssw0rd'     # Not used with sqlite3.\r\n    DATABASE_ENGINE   =  'mysql'        #mysql, etc\r\n    DATABASE_HOST     =  'localhost'\r\n    DATABASE_PORT     =  ''\r\n\r\n\r\n#. Give apache access to a few directories, /trunk/log and /trunk/forum/upfiles:\r\n\r\n\r\n   .. code-block :: bash\r\n    \r\n    $ chmod 777 log\r\n    $ chmod 777 forum/upfiles\r\n\r\n\r\n#. Create the database `(example syntax to create a mySQL database) <http://www.foxhop.net/mySQL#create-database>`_:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ python manage.py syncdb --all\r\n    $ python manage.py migrate forum --fake\r\n\r\n\r\nSetup Apache2 and mod_wsgi\r\n--------------------------------\r\n\r\n#. Turn on mod_rewrite:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ a2enmod rewrite\r\n\r\n#. Create a sites-enabled vhost apache2 file:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo vi /etc/apache2/sites-enabled/007-lostquery\r\n\r\n#. Setup the host file:\r\n\r\n   .. code-block :: apache\r\n\r\n    #lostquery.com\r\n\r\n    #Djangos embeded mod_wsgi\r\n    <VirtualHost *:80>\r\n        ServerName lostquery.com\r\n        ServerAlias www.lostquery.com\r\n        ServerAdmin foxhop1@gmail.com\r\n\r\n        # ReWrite URL to WWW\r\n        RewriteEngine On\r\n        RewriteCond %{HTTP_HOST} ^www.lostquery.com\r\n        RewriteRule (.*) http://lostquery.com$1 [R=301,L]\r\n\r\n        # Log Files\r\n        ErrorLog /var/log/apache2/error-lostquery.log\r\n        CustomLog /var/log/apache2/access-lostquery.log combined\r\n\r\n        # Setup mod_wsgi\r\n        WSGIScriptAlias / /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n        <Directory /www/lostquery.com/mod_wsgi>\r\n         Order deny,allow\r\n         Allow from all\r\n        </Directory>\r\n     </VirtualHost>\r\n\r\n#. Create the egg-cache directory:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi\r\n\r\n    $ mkdir /www/lostquery.com/mod_wsgi/egg-cache\r\n\r\n#. Create the wsgi dispatch file:\r\n\r\n   .. code-block :: bash\r\n  \r\n    $ vi /www/lostquery.com/mod_wsgi/dispatch.wsgi\r\n\r\n#. Setup the wsgi dispatch file:\r\n\r\n   .. code-block :: python\r\n    :linenos:\r\n\r\n    import os\r\n    import sys \r\n    sys.stdout = sys.stderr\r\n    # Add the virtual Python environment site-packages directory to the path\r\n    import site\r\n    site.addsitedir('/www/lostquery.com/virtpy/lib/python2.6/site-packages')\r\n\r\n\r\n    # Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages  \r\n    import os\r\n    os.environ['PYTHON_EGG_CACHE'] = '/www/lostquery.com/mod_wsgi/egg-cache'\r\n\r\n    #If your project is not on your PYTHONPATH by default you can add the following\r\n    sys.path.append('/www/lostquery.com/trunk')\r\n    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\r\n\r\n\r\n    import django.core.handlers.wsgi\r\n    application = django.core.handlers.wsgi.WSGIHandler()\r\n \r\n\r\n\r\n\r\n\r\nReset apache2\r\n=================\r\n\r\n#. Reset apache2 so that it reads in the new config files:\r\n\r\n   .. code-block :: bash\r\n\r\n    $ sudo service apache2 restart\r\n\r\n", "source_format": "rst", "revision_number": 1, "created": 1276973965000}], "count": 20}