{"revision": {"id": "f29394b4-2f95-11f1-b8b7-e86a64d24d78", "node_id": "f2924939-2f95-11f1-8a03-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Setting up a pylowiki site\r\n...................................\r\n\r\nThis page will outline the steps needed to setup a production pylowiki site.  \r\n\r\nIf you are interested in running a demo or local version of pylowiki, check out the `minimal pylowiki setup instructions </pylowiki#installation-and-setup>`_.\r\n\r\nIn this tutorial we will be configuring pylowiki to run:\r\n\r\n* on ubuntu linux\r\n* as a wsgi application\r\n* with an apache2 webserver\r\n* in a python virtualenv\r\n* with a mysql database backend\r\n\r\n\r\n.. contents::\r\n\r\n\r\n\r\nGet the Pylowiki sourcecode\r\n=================================\r\n\r\nThe pylowiki sourcecode is hosted at bitbucket.org.  You will need mecurial (hg) revision control to download the source.\r\n\r\nFor debian or ubuntu\r\n\r\n.. code-block:: shell\r\n\r\n    sudo apt-get install mercurial\r\n\r\nOnce you have mercurial you need to clone the pylowiki sourcecode\r\n\r\n.. code-block:: shell\r\n    \r\n    hg clone http://bitbucket.org/russellballestrini/pylowiki\r\n\r\n    mv pylowiki mysite\r\n\r\nNow you should have the sourcecode in local filesystem.  You might want to come up with a workflow to maintain your changes and still accept revisions from the upstream pylowiki repository.  I'll leave that up to you.\r\n\r\n\r\nFix file permissions\r\n=======================\r\n\r\nThe web server account only needs access to a few directories.  All the other files may be owned by your id.\r\n\r\nRun the following commands from the root of your Pylowiki project directory to correct permissions.\r\n\r\n\r\n.. code-block:: c\r\n\r\n  mkdir egg-cache data\r\n\r\n  sudo chgrp -R www-data pylowiki/public/attachment\r\n  sudo chmod -R 774 pylowiki/public/attachment\r\n\r\n  sudo chgrp -R www-data egg-cache\r\n  sudo chmod -R 774 egg-cache\r\n\r\n  sudo chgrp -R www-data data\r\n  sudo chmod -R 774 data\r\n\r\nGet a Pylons virtual environment\r\n====================================\r\n\r\nOfficial Pylons setup notes: http://pylonshq.com/docs/en/1.0/gettingstarted/\r\n\r\n.. code-block:: apache \r\n\r\n wget http://www.pylonshq.com/download/1.0/go-pylons.py\r\n\r\n python go-pylons.py virtpy\r\n\r\nTo enable the virtual environment run:\r\n\r\n.. code-block:: apache \r\n\r\n source virtpy/bin/activate\r\n \r\n\r\nInstall your Pylowiki application\r\n========================================\r\n\r\nMake sure your currently inside your virtual python environment.  Your shell should look like this:\r\n\r\n.. code-block:: php\r\n\r\n  (virtpy)user@host$ python setup.py develop\r\n\r\nNotice the (virtpy)?  The above command will install Pylowiki and all its dependencies into your virtual pythons site-lib.\r\n\r\nConfigure Pylowiki - prod.ini\r\n========================================\r\n\r\nThe following command should be run in the root of your pylowiki project.  This will create a configuration ini named prod.ini:\r\n\r\n.. code-block:: apache\r\n\r\n  paster make-config Pylowiki prod.ini\r\n\r\nOpen prod.ini for editing and make changes to reflect your environment.  Lots of choices. : )\r\n  \r\n\r\nConfigure apache2 and mod_wsgi\r\n=====================================\r\n\r\nFirst step is to create the mod_wsgi dispatch file.\r\n\r\nFrom the root directory of the Pylowiki project, create a *dispatch.wsgi* file with the following content:\r\n\r\n.. code-block:: python\r\n\r\n # Add the virtual Python environment site-packages directory to the path\r\n import sys\r\n sys.stdout = sys.stderr\r\n\r\n import site\r\n site.addsitedir('/absolute/path/to/virtpy/lib/python2.6/site-packages')\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'] = '/absolute/path/to/pylowiki/egg-cache'\r\n\r\n # Load the Pylons application\r\n from paste.deploy import loadapp\r\n application = loadapp('config:/absolute/path/to/pylowiki/prod.ini')\r\n\r\n\r\n", "source_format": "rst", "revision_number": 19, "created": 1286633158000}}