这是我目前assets.py
文件编译。麻烦的建立目录从Django的资产/ Webassets
无论如何,我将register('sass', sass)
更改为register('sass_all', sass)
以避开错误。当我去编译它正在寻找我的scripts
目录,我保持manage.py
。在settings.py
我补充一下:
ASSETS_ROOT = [
'static',
]
刚刚有看在scripts/static
不存在。
尝试:
# This is already in settings.py
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
# Added new line
ASSETS_ROOT = [
STATICFILES_DIRS,
]
它会产生一个错误的夫妇:KeyError: 'directory'
,OSError: The environment has no "directory" configured
,并AttributeError: 'list' object has no attribute 'startswith'
。真的,这只是一个错误,directory
没有定义,我想。
通过environment documentation进行阅读,这在我的技能水平上是含糊不清的。在assets.py
中加入Environment
至import
只是说Could not import in Environment
。在Environment is not defined
中添加Environment.directory('static')
结果。只是directory('static')
也导致directory is not defined
。 env = Environment()
同样的事情。试图添加directory='/static'
到sass = Bundle(...)
,它只是说TypeError: got unexpected keyword argument 'directory'
。
无论如何,花了几个小时,并再次卡住。文档似乎指示directory
设置应该在assets.py
而不是settings.py
,而ASSETS_ROOT
应该在settings.py
。
再次提前致谢!从这个问题
~/portal-client
project_dir
apps
account
templates
account
login.html
forms.py
urls.py
views.py
home
templates
home
home.html
urls.py
views.py
results
assets.py
settings.py
urls.py
scripts
manage.py
static
build
main.js
main.sass
css
app.css
main.css
js
app.js
main.js
media
templates
base.html
footer.html
title.html
继续:Trouble adding Django-Assets/Webassets directory to look for assets.py files
再次感谢第三次关于这个问题!运行良好,我也有缓存破坏工作(不喜欢它保留每个版本,但至少它选择最新的,但我会采取我现在可以得到的东西...杂乱是一个不同的日子的主题)。实际上深入到Django! – sockpuppet