andreyfedoseev / django-coffeescript Goto Github PK
View Code? Open in Web Editor NEWDjango template tags to compile CoffeeScript
License: Other
Django template tags to compile CoffeeScript
License: Other
If it caches to a path relative to STATIC_ROOT then how am I suppose to serve it in development since STATICFILES_DIRS can't have STATIC_ROOT in it?
смотри какая петрушка получается. Если ты отлаживаешься локально, например в PyCharm'e и для отдачи статики в urls.py пользуешь примерно вот это:
if settings.DEBUG:
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()
urlpatterns += patterns('',
url(r'^{0}(?P<path>.*)$'.format(settings.MEDIA_URL.lstrip('/')), 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT,
}),
)
то джанга сама ищет статику по всех аппах, и уже не смотрит в staticfiles_dirs
в итоге получается, что такой замечательный продукт работает в продакшене и не работает в дебаг режиме :(
выход который видится мне - в дебаг-моде искать файл аналогично джанге и создавать COFFEESCRIPT_OUTPUT_DIR рядом с файлом скрипта в аппе.
I've run in another little probleem with (django-coffeescript and) django-less:
I use the staticfiles app to collect my staticfiles, and have some less-file in custom/static/custom/style.less
In my development environment, I prefer not to do "collectstatic" all the time, so I use the following code in my urls.py:
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Now if I use the following code in my templates, django-less can't find the source less file.
{% load less %}
{% less 'custom/style.less' %}
I think it would be a nice feature if django-less would try to find files in the dirs that staticfiles searches (as a fallback for the STATIC_ROOT directory).
I know, we shouldn't use windows ;)
However, windows users get an access denied error when calling the coffee executable.
This function call (in the templatetag):
p = subprocess.Popen(args, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
need to have an additional shell=True keyword argument..
TemplateSyntaxError at /startups/
'coffeescript' is not a valid tag library: Template library coffeescript not found, tried django.templatetags.coffeescript,django.contrib.admin.templatetags.coffeescript,django.contrib.staticfiles.templatetags.coffeescript,django_extensions.templatetags.coffeescript
Request Method: GET
Request URL: http://localhost:8000/startups/
Django Version: 1.6
Exception Type: TemplateSyntaxError
Exception Value:
'coffeescript' is not a valid tag library: Template library coffeescript not found, tried django.templatetags.coffeescript,django.contrib.admin.templatetags.coffeescript,django.contrib.staticfiles.templatetags.coffeescript,django_extensions.templatetags.coffeescript
Exception Location: /usr/local/lib/python2.6/dist-packages/django/template/defaulttags.py in load, line 1084
Python Executable: /usr/bin/python
Python Version: 2.6.5
Python Path:
['/home/piousbox/projects/startups',
'/usr/local/lib/python2.6/dist-packages/distribute-0.7.3-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/setuptools-1.3.2-py2.6.egg',
'/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk',
'/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload',
'/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL',
'/usr/lib/python2.6/dist-packages/gst-0.10',
'/usr/lib/pymodules/python2.6',
'/usr/lib/python2.6/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.6/gtk-2.0',
'/usr/local/lib/python2.6/dist-packages']
Server time: Sun, 15 Dec 2013 20:01:02 +0000
Error during template rendering
In template /home/piousbox/projects/startups/templates/layouts/base.html, error at line 1
'coffeescript' is not a valid tag library: Template library coffeescript not found, tried django.templatetags.coffeescript,django.contrib.admin.templatetags.coffeescript,django.contrib.staticfiles.templatetags.coffeescript,django_extensions.templatetags.coffeescript
1 {% load coffeescript %}
2
3
4
5
6
7 <title>{{ page_title }}</title>
8
9
10
11
django.utils.hashcompat is deprecated in Django 1.5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.