<commit_before>Installing Media Tree
*********************

This document assumes you are familiar with Python and Django.


Dependencies
============

Make sure to install these packages prior to installation:

- Django >= 1.2.5
- south >= 0.7.2
- django-mptt > 0.4.2
- PIL >= 1.1

Getting the code
================

For the latest stable version (recommended), use ``pip`` or ``easy_install``::

    $ pip install django-media-tree  

**Alternatively**, you can also download the latest development version from 
http://github.com/philomat/django-media-tree and run the installation script::

    $ python setup.py install

**or** use ``pip``::

    $ pip install -e git://github.com/philomat/django-media-tree#egg=django-media-tree


Basic setup
===========

- In your project settings, add ``media_tree`` to the ``INSTALLED_APPS``::

    INSTALLED_APPS = (
        # ... your other apps here
        'mptt',
        'media_tree',
    )

- A version of ``django-mptt`` **newer than 0.4.2** is required because there is
  an issue with older versions not indenting the folder list correctly. There
  are two ways of resolving this. If you can't use a newer version, put
  ``legacy_mptt_support`` in your ``INSTALLED_APPS`` **before** ``mptt``::

    INSTALLED_APPS = (
        # ... your other apps here
        'media_tree.contrib.legacy_mptt_support',
        'mptt',
        'media_tree',
    )
  
  Alternatively, you can use the current development version of
  ``django-mptt``::

    $ sudo pip install -e git://github.com/django-mptt/django-mptt#egg=django-mptt

- If you are using ``django.contrib.staticfiles`` (recommended), just run the
  usual command to collect static files::

    $ ./manage.py collectstatic

  If you are **not** using the ``staticfiles`` app, copy the contents of the
  ``static`` folder to the static root of your project.
  
  .. Note::
     To learn about the ``staticfiles`` app please refer to the
     `respective Django documentation
     <https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/>`_.

.. _configuring-media-backends:

- **Configuring media backends (optional)**: If you want thumbnails to be
  generated, which will usually be the case, you need to install the appropriate
  media backend that takes care of this. Currently, `easy-thumbnails
  <https://github.com/SmileyChris/easy-thumbnails>`_ is the only recommended and
  officially supported 3rd-party application.

  After you've installed the ``easy_thumbnails`` module, configure Media Tree to
  use it by defining ``MEDIA_TREE_MEDIA_BACKENDS`` in your project settings::
  
      MEDIA_TREE_MEDIA_BACKENDS = (
          'media_tree.contrib.media_backends.easy_thumbnails.EasyThumbnailsBackend',
      )

  .. Note::
     In principle, Media Tree can work together with any other thumbnail
     generating app, provided that you write the appropriate media backend class
     to support it. Please have a look at one of the backends under
     ``media_tree.contrib.media_backends`` if you are interested in using your
     own specific 3rd-party app. 

- **Optional**: Also add any Media Tree extensions that you are planning to use
  to your ``INSTALLED_APPS``::

    INSTALLED_APPS = (
        # ... your other apps here
        'media_tree.contrib.media_extensions.images.focal_point',
        'media_tree.contrib.media_extensions.zipfiles',
    )

    .. Note::
       See :ref:`bundled-extensions` for a list of default extensions included in the project.

.. _install-swfupload:

- **Optional**: If you are planning to use a Flash uploader such as
  ``SWFUpload``, add ``SessionPostMiddleware`` to your ``MIDDLEWARE_CLASSES``::

    MIDDLEWARE_CLASSES = (
        # ...
        'media_tree.middleware.SessionPostMiddleware',
        # Notice that ``SessionPostMiddleware`` goes before ``SessionMiddleware`` 
        'django.contrib.sessions.middleware.SessionMiddleware',<commit_msg>Edited docs/installation.rst via GitHub<commit_after>Installing Media Tree
*********************

This document assumes you are familiar with Python and Django.


Dependencies
============

Make sure to install these packages prior to installation:

- Django >= 1.2.5
- south >= 0.7.2
- django-mptt > 0.4.2
- PIL >= 1.1

Getting the code
================

For the latest stable version (recommended), use ``pip`` or ``easy_install``::

    $ pip install django-media-tree  

**Alternatively**, you can also download the latest development version from 
http://github.com/philomat/django-media-tree and run the installation script::

    $ python setup.py install

**or** use ``pip``::

    $ pip install -e git://github.com/philomat/django-media-tree#egg=django-media-tree


Basic setup
===========

- In your project settings, add ``media_tree`` to the ``INSTALLED_APPS``::

    INSTALLED_APPS = (
        # ... your other apps here
        'mptt',
        'media_tree',
    )

- A version of ``django-mptt`` **newer than 0.4.2** is required because there is
  an issue with older versions not indenting the folder list correctly. There
  are two ways of resolving this. If you can't use a newer version, put
  ``legacy_mptt_support`` in your ``INSTALLED_APPS`` **before** ``mptt``::

    INSTALLED_APPS = (
        # ... your other apps here
        'media_tree.contrib.legacy_mptt_support',
        'mptt',
        'media_tree',
    )
  
  Alternatively, you can use the current development version of
  ``django-mptt``::

    $ sudo pip install -e git://github.com/django-mptt/django-mptt#egg=django-mptt

- If you are using ``django.contrib.staticfiles`` (recommended), just run the
  usual command to collect static files::

    $ ./manage.py collectstatic

  If you are **not** using the ``staticfiles`` app, copy the contents of the
  ``static`` folder to the static root of your project.
  
  .. Note::
     To learn about the ``staticfiles`` app please refer to the
     `respective Django documentation
     <https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/>`_.

.. _configuring-media-backends:

- **Configuring media backends (optional)**: If you want thumbnails to be
  generated, which will usually be the case, you need to install the appropriate
  media backend that takes care of this. Currently, `easy-thumbnails
  <https://github.com/SmileyChris/easy-thumbnails>`_ is the only recommended and
  officially supported 3rd-party application.

  After you've installed the ``easy_thumbnails`` module, configure Media Tree to
  use it by defining ``MEDIA_TREE_MEDIA_BACKENDS`` in your project settings::
  
      MEDIA_TREE_MEDIA_BACKENDS = (
          'media_tree.contrib.media_backends.easy_thumbnails.EasyThumbnailsBackend',
      )

  .. Note::
     In principle, Media Tree can work together with any other thumbnail
     generating app, provided that you write the appropriate media backend class
     to support it. Please have a look at one of the backends under
     ``media_tree.contrib.media_backends`` if you are interested in using your
     own specific 3rd-party app. 

- **Optional**: Also add any Media Tree extensions that you are planning to use
  to your ``INSTALLED_APPS``::

    INSTALLED_APPS = (
        # ... your other apps here
        'media_tree.contrib.media_extensions.images.focal_point',
        'media_tree.contrib.media_extensions.zipfiles',
    )

  .. Note::
     See :ref:`bundled-extensions` for a list of default extensions included in the project.

.. _install-swfupload:

- **Optional**: If you are planning to use a Flash uploader such as
  ``SWFUpload``, add ``SessionPostMiddleware`` to your ``MIDDLEWARE_CLASSES``::

    MIDDLEWARE_CLASSES = (
        # ...
        'media_tree.middleware.SessionPostMiddleware',
        # Notice that ``SessionPostMiddleware`` goes before ``SessionMiddleware`` 
        'django.contrib.sessions.middleware.SessionMiddleware',
{'fraction_non_alphanumeric': 0.11626721060683325, 'fraction_numerical': 0.00407955124936257, 'mean_word_length': 3.4272009029345374, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7110520', 'n_tokens_mistral': 2381, 'n_tokens_neox': 2233, 'n_words': 778}