Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compress merge own test templates to production code #696

Closed
ondrejsika opened this issue Nov 22, 2015 · 5 comments
Closed

compress merge own test templates to production code #696

ondrejsika opened this issue Nov 22, 2015 · 5 comments
Labels

Comments

@ondrejsika
Copy link

Hi, I have a problem. Compress command fails with:

CommandError: An error occured during rendering /home/projects/pool/web-pool/.env/lib/python2.7/site-packages/compressor/tests/test_templates/test_static_templatetag/test_compressor_offline.html: 'js/one.js' could not be found in the COMPRESS_ROOT '/home/projects/pool/web-pool/static/static' or with staticfiles.

When I add js/one.js to assets, it works properly.

Thanks, Ondrej

@diox diox added the bug label Nov 23, 2015
@diox
Copy link
Member

diox commented Nov 23, 2015

That's weird. More info is needed, what are your settings ?

@ondrejsika
Copy link
Author

Here is key part of my settings.py

DEBUG = False
COMPRESS_ENABLED = True
COMPRESS_OFFLINE = True

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.core.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    'django.core.context_processors.request',
    'web.context_processors.main',

    # CMS
    'sekizai.context_processors.sekizai',
    'django.core.context_processors.static',
    'cms.context_processors.cms_settings',
)

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.DefaultStorageFinder',
    'compressor.finders.CompressorFinder',
)
COMPRESS_PRECOMPILERS = (
    ('text/coffeescript', 'coffee --compile --stdio'),
    ('text/x-scss', 'django_libsass.SassCompiler'),
)

STATIC_ROOT = os.path.join(BASE_DIR, 'static', 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'static', 'static', 'uploads')

@karyon
Copy link
Contributor

karyon commented Apr 24, 2016

did you find the cause in the meantime? if not, could you provide the full settings.py? i can't reproduce this even when copying all the parts you posted.

@karyon
Copy link
Contributor

karyon commented Jun 1, 2016

not enough information, closing.

@karyon karyon closed this as completed Jun 1, 2016
@kubijo
Copy link

kubijo commented Aug 11, 2017

Hi.

I've been looking into this again and have been able to trace the issue to our misconfiguration of django's template finder; so if anyone has similar issue, here's the solution

The issues was really that compress tried to process templates which it weren't supposed to and so here is the config that was causing the problems (mind the BASE_DIR included in DIRS)

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR, 'templates'],
        'APP_DIRS': True,
    }  

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants