diff --git a/dpaste/settings/base.py b/dpaste/settings/base.py index 2017f90..a6d7eff 100644 --- a/dpaste/settings/base.py +++ b/dpaste/settings/base.py @@ -117,6 +117,7 @@ TEMPLATES = [ ] INSTALLED_APPS = ( + 'staticinline', 'django.contrib.staticfiles', 'django.contrib.sessions', 'dpaste.apps.dpasteAppConfig', diff --git a/dpaste/templates/dpaste/base.html b/dpaste/templates/dpaste/base.html index bbd1574..0a7992f 100644 --- a/dpaste/templates/dpaste/base.html +++ b/dpaste/templates/dpaste/base.html @@ -1,6 +1,6 @@ {% load i18n %} {% load staticfiles %} -{% load dpaste_tags %} +{% load staticinline %} @@ -8,7 +8,7 @@ {% block title %}{% endblock %} {% block meta %}{% endblock %} - + @@ -25,6 +25,6 @@
{% block page %}{% endblock %}
- + diff --git a/dpaste/templatetags/__init__.py b/dpaste/templatetags/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dpaste/templatetags/dpaste_tags.py b/dpaste/templatetags/dpaste_tags.py deleted file mode 100644 index 49a407c..0000000 --- a/dpaste/templatetags/dpaste_tags.py +++ /dev/null @@ -1,54 +0,0 @@ -import os -from logging import getLogger - -from django.conf import settings -from django.contrib.staticfiles.finders import find -from django.template.defaulttags import register -from django.utils.safestring import mark_safe -from django.contrib.staticfiles.storage import staticfiles_storage - -logger = getLogger(__file__) - - -@register.simple_tag() -def inlinestatic(path): - """ - Similiar to Django's native `static` templatetag, but this includes - the file directly in the template, rather than a link to it. - - Example: - - - - - Becomes: - - - - - Raises a ValueError if the the file does not exist, and - DEBUG is enabled. - - :param path: (string) Filename of the file to include. - :return: (string) The included File or an empty string `''` if the - file was not found, and DEBUG is disabled. - """ - # Filename in build/ directory (when in Watch mode) - filename = find(path) - - # File in collectstatic target directory (regular deployment) - if not filename: - if staticfiles_storage.exists(path): - filename = staticfiles_storage.path(path) - - # If it wasn't found, raise an error if in DEBUG mode. - if not filename or not os.path.exists(filename): - logger.error('Unable to include inline static file "%s", ' - 'file not found.', filename) - if settings.DEBUG: - raise ValueError('Unable to include inline static file "{0}", ' - 'file not found.'.format(filename)) - return '' - - return mark_safe(open(filename).read()) - diff --git a/setup.py b/setup.py index 5d8b80c..c9f5220 100644 --- a/setup.py +++ b/setup.py @@ -4,12 +4,12 @@ from setuptools import find_packages, setup long_description = '\n\n'.join(( open('README.rst').read(), - open('CHANGELOG').read() + open('CHANGELOG.rst').read() )) setup( name='dpaste', - version='3.0a3', + version='3.0a4', description='dpaste is a Django based pastebin. It\'s intended to run ' 'separately but its also possible to be installed into an ' 'existing Django project like a regular app.', @@ -36,6 +36,7 @@ setup( # Essential packages 'django>=1.11', 'pygments>=1.6', + 'django-staticinline>=1.0', # Additional Code Lexer 'pygments-lexer-solidity>=0.1.0',