Made a cms project in django, but its not loading my default template for flatpages, attached are the images.
Thanks
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.flatpages',
]
SITE_ID = 1
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
]
Did you set the TEMPLATES
in your settings.py
? Check and set the TEMPLATES.DIR
setting to your folder path:
TEMPLATES = {
'DIRS': [os.path.join(BASE_DIR, 'templates')],
}
Moreover, you can move the templates
folder inside the cms
folder. In this case, be sure that TEMPLATES.APP_DIRS
is set to True
.
cms
+- cms/
+- templates/
+- flatpages/
+- default.html
+- views.py
+- other django stuff...
+- db.sqlite3
You can find more information in the official documentation: https://docs.djangoproject.com/en/2.1/topics/templates/#configuration