<commit_before>.. _quickwiki_tutorial:

.. quickwiki-tutorial:

==================
Quickwiki tutorial
==================

Introduction 
============ 

If you haven't done so already, please first read the :ref:`getting_started` guide. 

In this tutorial we are going to create a working wiki from scratch using Pylons 0.9.7 and `SQLAlchemy`_. Our wiki will allow visitors to add, edit or delete formatted wiki pages. 

Starting at the End 
=================== 

Pylons is designed to be easy for everyone, not just developers, so let's start by downloading and installing the finished QuickWiki in exactly the same way that end users of QuickWiki might do. Once we have explored its features we will set about writing it from scratch.

After you have installed `Easy Install <http://peak.telecommunity.com/DevCenter/EasyInstall>`_ run these commands to install QuickWiki and create a config file: 

.. code-block :: bash 

    $ easy_install QuickWiki==0.1.6 
    $ paster make-config QuickWiki test.ini 

Next, ensure that the ``sqlalchemy.url`` variable in the ``[app:main]`` section of the configuration file (``development.ini``) specifies a value that is suitable for your setup. The data source name points to the database you wish to use. 

.. note :: 

    The default ``sqlite:///%(here)s/quickwiki.db`` uses a (file-based) SQLite database named ``quickwiki.db`` in the ini's top-level directory. This SQLite database will be created for you when running the :command:`paster setup-app` command below, but you could also use MySQL, Oracle or PostgreSQL. Firebird and MS-SQL may also work. See the `SQLAlchemy documentation <http://www.sqlalchemy.org/docs/04/dbengine.html#dbengine_establishing>`_ for more information on how to connect to different databases. SQLite for example requires additional forward slashes in its URI, where the client/server databases should only use two. You will also need to make sure you have the appropriate Python driver for the database you wish to use. If you're using Python 2.5, a version of the `pysqlite adapter <http://www.initd.org/tracker/pysqlite/wiki/pysqlite>`_ is already included, so you can jump right in with the tutorial. You may need to get `SQLite itself <http://www.sqlite.org/download.html>`_. 

Finally create the database tables and serve the finished application: 

.. code-block :: bash 

    $ paster setup-app test.ini 
    $ paster serve test.ini 

That's it! Now you can visit http://127.0.0.1:5000 and experiment with the finished Wiki. 

When you've finished, stop the server with :kbd:`Control-C` so we can start developing our own version. 

If you are interested in looking at the latest version of the QuickWiki source code it can be browsed online at http://www.knowledgetap.com/hg/QuickWiki or can be checked out using `Mercurial <http://www.selenic.com/mercurial/>`_:

.. code-block :: bash 

    $ hg clone http://www.knowledgetap.com/hg/QuickWiki 

Developing QuickWiki 
==================== 

If you skipped the "Starting at the End" section you will need to assure yourself that you have Pylons installed. See the :ref:`getting_started`.

Then create your project: 

.. code-block :: bash 

    $ paster create -t pylons QuickWiki

When prompted for which templating engine to use, simply hit enter for the default (Mako). When prompted for SQLAlchemy configuration, enter ``True``.

Now let's start the server and see what we have: 

.. code-block :: bash <commit_msg>put back the egg_info command requirement for the checked out version, it's still needed<commit_after>.. _quickwiki_tutorial:

.. quickwiki-tutorial:

==================
Quickwiki tutorial
==================

Introduction 
============ 

If you haven't done so already, please first read the :ref:`getting_started` guide. 

In this tutorial we are going to create a working wiki from scratch using Pylons 0.9.7 and `SQLAlchemy`_. Our wiki will allow visitors to add, edit or delete formatted wiki pages. 

Starting at the End 
=================== 

Pylons is designed to be easy for everyone, not just developers, so let's start by downloading and installing the finished QuickWiki in exactly the same way that end users of QuickWiki might do. Once we have explored its features we will set about writing it from scratch.

After you have installed `Easy Install <http://peak.telecommunity.com/DevCenter/EasyInstall>`_ run these commands to install QuickWiki and create a config file: 

.. code-block :: bash 

    $ easy_install QuickWiki==0.1.6 
    $ paster make-config QuickWiki test.ini 

Next, ensure that the ``sqlalchemy.url`` variable in the ``[app:main]`` section of the configuration file (``development.ini``) specifies a value that is suitable for your setup. The data source name points to the database you wish to use. 

.. note :: 

    The default ``sqlite:///%(here)s/quickwiki.db`` uses a (file-based) SQLite database named ``quickwiki.db`` in the ini's top-level directory. This SQLite database will be created for you when running the :command:`paster setup-app` command below, but you could also use MySQL, Oracle or PostgreSQL. Firebird and MS-SQL may also work. See the `SQLAlchemy documentation <http://www.sqlalchemy.org/docs/04/dbengine.html#dbengine_establishing>`_ for more information on how to connect to different databases. SQLite for example requires additional forward slashes in its URI, where the client/server databases should only use two. You will also need to make sure you have the appropriate Python driver for the database you wish to use. If you're using Python 2.5, a version of the `pysqlite adapter <http://www.initd.org/tracker/pysqlite/wiki/pysqlite>`_ is already included, so you can jump right in with the tutorial. You may need to get `SQLite itself <http://www.sqlite.org/download.html>`_. 

Finally create the database tables and serve the finished application: 

.. code-block :: bash 

    $ paster setup-app test.ini 
    $ paster serve test.ini 

That's it! Now you can visit http://127.0.0.1:5000 and experiment with the finished Wiki. 

When you've finished, stop the server with :kbd:`Control-C` so we can start developing our own version. 

If you are interested in looking at the latest version of the QuickWiki source code it can be browsed online at http://www.knowledgetap.com/hg/QuickWiki or can be checked out using `Mercurial <http://www.selenic.com/mercurial/>`_:

.. code-block :: bash 

    $ hg clone http://www.knowledgetap.com/hg/QuickWiki 

.. Note::

    To run the QuickWiki checked out from the repository, you'll need to first run :command:`python setup.py egg_info` from the project's root directory. This will generate `Python Egg <http://peak.telecommunity.com/DevCenter/PythonEggs>`_ metadata required for the :command:`paster` command (among other things) in a :file:`QuickWiki.egg-info` directory.

    .. code-block :: bash 

        $ cd QuickWiki
        $ python setup.py egg_info

Developing QuickWiki 
==================== 

If you skipped the "Starting at the End" section you will need to assure yourself that you have Pylons installed. See the :ref:`getting_started`.

Then create your project: 

.. code-block :: bash 

    $ paster create -t pylons QuickWiki

When prompted for which templating engine to use, simply hit enter for the default (Mako). When prompted for SQLAlchemy configuration, enter ``True``.

Now let's start the server and see what we have: 

.. code-block :: bash 
{'fraction_non_alphanumeric': 0.09887005649717515, 'fraction_numerical': 0.0053806833467850415, 'mean_word_length': 4.106456043956044, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 12, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5621055', 'n_tokens_mistral': 2173, 'n_tokens_neox': 1964, 'n_words': 952}