GithubHelp home page GithubHelp logo

hartwork / django-directory Goto Github PK

View Code? Open in Web Editor NEW

This project forked from askbot/django-directory

0.0 3.0 0.0 25 KB

Django app to list contents of the directory and download files.

Python 79.17% HTML 9.24% Shell 11.58%

django-directory's Introduction

A simple app for Django 1.11.x and Python 2.7 that allows listing and downloading files from a given directory, while controlling who can access the files.

Installation

python manage.py migrate is not required as there are no models.

Add to the settings.py file::

INSTALLED_APPS += ['directory']

DIRECTORY_DIRECTORY = '/path/to/dir'

That's the directory to be listed.

Add to the urls.py file the url entry, e.g.:

('^files/', include('directory.urls')),

Dependencies

If setting DIRECTORY_ACCESS_MODE is set to 'check-perms', or (possibly) 'custom', then this app will require django.contrib.auth installed in the project.

Configuration

Setting DIRECTORY_ACCESS_MODE, can be one of: 'public', 'check-perms', 'custom', value 'public' is default.

  • value 'public' means that anyone can see the directory and download files.
  • 'check-perms' means that django permission 'directory_read' from django.contrib.auth will be checked
  • 'custom' - means that function provided with DIRECTORY_ACCESS_FUNCTION will be called to check the permission

DIRECTORY_ACCESS_FUNCTION - a function or python path to the custom permission checking function e.g. 'myapp.perms.check_get_backups_perm'.

The function should accept parameter request and return a Boolean value - access granted if True.

DIRECTORY_TEMPLATE - path to the template file for the directory listing. Default value is 'directory/list.html'

django-directory's People

Contributors

evgenyfadeev avatar hartwork avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.