我正在尝试将 CSS 样式添加到要发送的 html 电子邮件中,因此我使用django-inlinecss 0.3.0
了但我不断收到此错误:
The joined path (C:\css\bootstrap.css) is located outside of the base path component (C:\Users\User\Desktop\static_root)
在我的模板中,我使用以下内容:
{% load inlinecss %}
{% inlinecss "/css/bootstrap.css" %}
TEXT
{% endinlinecss %}
调试后发现原因是由于
[Errno 2] No such file or directory: 'C:\\Users\\User\\Desktop\\static_root\\css\\bootstrap.css'
这是文件结构:
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static_in_env')]
VENV_PATH = os.path.dirname(BASE_DIR)
STATIC_ROOT = os.path.join(VENV_PATH, 'static_root')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
那么,我应该如何解决这个错误呢?