<commit_before># README

Serving media based on authorization checks

Download the repo:

    git clone https://github.com/depaolim/django_auth_media.git

Add the folder django\_auth\_media to your pythonpath

The app is tested on Django 1.6.7 and has no dependency from other packages (apart from django itsef)


## Usage

Steps:

1. Add the app django\_auth\_media to INSTALLED\_APPS in settings.py

2. Add MEDIA\_URL  and MEDIA\_ROOT in settings.py

3. Add MEDIA\_REDIRECT in settings.py

    Use the same path used in "location" in nginx config. Example:

    settings.py:

        MEDIA_REDIRECT = "/internal_media"

    nginx.conf:

        location /internal_media {
            internal;
            alias /home/dslcm_data/dslcm_media;
        }


4. Add urlpatters in urls.py

5. Use auth\_media.AuthMediaField in place of models.FileField


## Test

To run tests:
<commit_msg>README update<commit_after># README

Serving media based on authorization checks

Download the repo:

    git clone https://github.com/depaolim/django_auth_media.git

The app is tested on Django 1.6.7 and has no dependency from other packages (apart from django itsef)


## Usage

Steps:

1. Add the folder django\_auth\_media to your PYTHONPATH

2. Add the app django\_auth\_media to INSTALLED\_APPS in settings.py

3. Add MEDIA\_URL  and MEDIA\_ROOT in settings.py

4. Add MEDIA\_REDIRECT in settings.py

    Use the same path used in "location" in nginx config. Example:

    settings.py:

        MEDIA_REDIRECT = "/internal_media"

    nginx.conf:

        location /internal_media {
            internal;
            alias /path_to_media_files;
        }


5. Add urlpatters in urls.py

6. Use auth\_media.AuthMediaField in place of models.FileField


## Test

To run tests:

{'fraction_non_alphanumeric': 0.06960950764006792, 'fraction_numerical': 0.009620826259196379, 'mean_word_length': 2.894273127753304, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2511961', 'n_tokens_mistral': 594, 'n_tokens_neox': 559, 'n_words': 198}