What you can do is populate a path in your DIRS list in TEMPLATES in your settings file to the directory where your template is located. Then, you can use TemplateView from django.views.generic to pass in a HTML file to be served up by Django for that URL.
-- Something like this:
urls.py
from django.conf.urls import url
from django.views.generic import TemplateView
urlpatterns = [
url(r'^', include('grid.urls')),url(r'^learn-more$', TemplateView.as_view(template_url(r'^silk/', include('silk.urls', namespace='silk'))name ='index.html'))
]
url_patterns = [
]
settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates' ,
'DIRS': [os.path.join(BASE_DIR, '../templates')],
'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' ,
],
},
},
]
What you're doing here is telling django to look in this location for templates. Then, you're defining a URL that takes in the template name as a parameter to return when the URL his hit.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/21de099e-8735-47b3-9578-10c30ad7b1a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment