Code Monkey home page Code Monkey logo

django-remote-finder's Introduction

django-remote-finder

Source: https://github.com/garrison/django-remote-finder

Download: https://pypi.python.org/pypi/django-remote-finder

This is a simple package designed to solve the annoying problem of having to keep various javascript/css libraries updated within a Django package. A requirements.txt file allows us to specify external Python dependencies, but there is still no good way to keep Javascript dependencies outside the repository. Until now.

Get started by adding the following to settings.py:

# if omitted, default to {settings.STATIC_ROOT}/remote_finder_cache
REMOTE_FINDER_CACHE_DIR = '/path/to/staticfile/cache'

REMOTE_FINDER_RESOURCES = [
    ('jquery.min.js', 'http://code.jquery.com/jquery-2.0.2.min.js', 'sha1:1e0331b6dd11e6b511d2e3d75805f5ccdb3b83df'),
]

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'remote_finder.RemoteFinder',
)

And then e.g. in a template, you can write:

{% load static %}
<script src="{% static "jquery.min.js" %}"></script>

No more need to keep such files in the repository! ./manage.py runserver (with DEBUG=True) will download the files as needed, as will ./manage.py collectstatic.

NOTE: the Django documentation says "Static file finders are currently considered a private interface, and this interface is thus undocumented." As such, this package may break unexpectedly in the future. See https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-STATICFILES_FINDERS for details.

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.