Can't modify django rest framework base.html file
Are you missing the DIRS from the main settings.py (this tells us where to look for templates (override templates):
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
...
}
djangorestframework==3.5.x
I had the exact problem where the template was not picked up where the template existed in one of my project app directories, as such:
Project Structure
project/
app1/
templates/
app1/
...
rest_framework/
app.html
settings.py
DEBUG = True
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
...
],
'debug': DEBUG
},
},
]
I had to follow joao figueiredo
's comment, and add a specific template folder outside of the app directory.
Project Structure
project/
app1/
templates/
app1/
...
templates/ # Move your file to a specific template dir
rest_framework/
app.html
settings.py
DEBUG = True
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')], # look in this specific folder
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
...
],
'debug': DEBUG
},
},
]
Which version of Django REST Framework are you using? I made changes to the block footer in the base.html and this was planed for the 3.0 release.
Is your 'Hello !' also not showing in the source code of the page (you can get it by pressing CTRL+U)?
If yes, than it could eventually be an issue with CSS making the colour white. You can put 'Hello !' in a tag like this: <p>Hello !</p>
.
EDIT:
Additional info.
There was an issue with the sticky footer displaying always 60px below the page bottom, thus scrolling down was needed to see it. If you are using an older version this can be also causing the problem. The most important question is: is 'Hello !' not at all in the source HTML sent to the browser or is it there, but you can't see it on the page?
Please give me a feedback, so we can solve this.