报错内容
/
AttributeError
: 'Settings' object has no attribute
'GENERATED_STATIC_HTML_DIR'
环境
:django3
.0.2
file_path
= os
.path
.join
(
settings
.GENERATED_STATIC_HTML_DIR
,
'goods/' + str(sku_id
) + '.html'
)
with open(file_path
, 'w') as f
:
f
.write
(sku_html_text
)
template
= loader
.get_template
('index.html')
html_data
= template
.render
(context
)
file_path
= os
.path
.join
(settings
.GENERATED_STATIC_HTML_FILES_DIR
,'index.html')
with open(file_path
,'w') as f
:
f
.write
(html_data
)
成功!
总结: settings.GENERATED_STATIC_HTML_DIR,
改为:settings.GENERATED_STATIC_HTML_FILES_DIR,