Reputation: 27
I'm having the invalid block tag issue while trying to reference the styles.css file from my app file structure, even having configured everything as the django documentation (and several other answers here in stack overflow) .
I'm using django 2.2.3 in a python3.6 venv along with pureCSS lib.
Here's an overview of my project's files and configuration regarding the templates and the static dir/files:
1- settings.py INSTALLED_APPS and STATIC_URL definition:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'pyonlinecourses.core',
]
...
STATIC_URL = '/static/'
2- settings.py TEMPLATES definitions:
TEMPLATES_DIR = os.path.join(BASE_DIR, "pyonlinecourses/core/templates/")
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [TEMPLATES_DIR],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.static',
],
},
},
]
3- Django project directory structure:
- pyonlinecourses
- core
- migrations
- static
- css
- templates
- home **(issue located in this file)**
5- static
tag definition and reference in html file
<!doctype html>
{& load static &}
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="PyOnline Courses - Simple distance education virtual learning environment" />
<title>PyOnline MOOC</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.3.0/pure-min.css">
<link rel="stylesheet" href="{% static 'css/styles.css' %}" />
</head>
I'm at a loss trying to identify the source of the problem.
Upvotes: 0
Views: 27