I am trying to incorporate the django application into a web site that is mostly static html.
The directory configuration is as follows:
root/
├ var/
│ /wwwwwwwwwwwwwwwww.
│ h html/
│ st static
│ │ st style.css
│ │ bbase.js
│ │
│ wweb/
│ hhead.html
│ f footer.html
│ b base.html
│
└ opt/
└ django /
├ project/
│
├ apps/
├ ├ views.py
├ template/
├ index.html
I'd like django's /opt/django/template/index.html to load html under /var/www/html/web/, but I don't know how to include it.
I was wondering if I could use {%include"/var/www/html/web/head.html"%}
, but I couldn't.
Static html reads css and js, so I don't want to ruin the directory configuration.
If there is any good way, please let me know.
It's solved.
Edit TEMPLATES in setting.py as follows:
TEMPLATES=[
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'apps/template'), '/var/wwww/html/web/']
,
'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',
],
},
},
]
This allows
{%include"head.html"%}
.
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
581 PHP ssh2_scp_send fails to send files as intended
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.