I am trying to add CSS styling to my html email to be sent so I used `django-inlinecss 0.3.0`
In my template I am using the following:
{% load inlinecss %}
{% inlinecss "/css/bootstrap.css" %}
TEXT
{% endinlinecss %}
Here is the complete path of the CSS file:
C:\Users\User\Desktop\Project\static_in_env\css\bootstrap.css
I have tried the following: `{% inlinecss "static_in_env/css/bootstrap.css" %}`
After debugging I found that the reason is due to:
[Errno 2] No such file or directory: 'C:\\Users\\User\\Desktop\\static_root\\css\\bootstrap.css'
Here is the files structure:
# 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')
So, how should I fix this error?
Below is my usual setting for handlig the static & media files. And it works all the time.
in settings.py file , I have assigned the static & media files like this
And in project urls.py we need to enable if DEBUG=True,
Now in our html template, just load static files using below format,
This should resolve all static related file issue. May be try this and let me know if doesnt work.