-
Notifications
You must be signed in to change notification settings - Fork 115
Docs refer to non-existant KNOWLEDGE_BASE_TEMPLATE setting #42
Comments
I was also curious about this. The docs say that you just need to copy and modify the base.html into your own template folder.. but that isn't any good if the app is just using the default ones. |
I am also having this issue. This setting does exist, but doesn't seem to work. Look at the settings file line 18: BASE_TEMPLATE = getattr(settings, 'KNOWLEDGE_BASE_TEMPLATE', 'django_knowledge/base.html') However, it doesn't seem to have any effect when you make the change in your local settings.py. Here is a simple test, using Django's built in shell command from your projects root directory: % python manage.py shell
>>> from knowledge.settings import *
>>> print LOGIN_REQUIRED
False
>>> print LOGIN_URL
/path/to/my/local/custom/auth/login
>>> print BASE_TEMPLATE
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'BASE_TEMPLATE' is not defined As you can see, all of the others work, except BASE_TEMPLATE. |
Okay, I have found the issue. I assume both of you installed from pip just like I did? Well, here is the contents of from django.conf import settings
# crowd control
LOGIN_REQUIRED = getattr(settings, 'KNOWLEDGE_LOGIN_REQUIRED', False)
LOGIN_URL = getattr(settings, 'LOGIN_URL', '/accounts/login/')
ALLOW_ANONYMOUS = getattr(settings, 'KNOWLEDGE_ALLOW_ANONYMOUS', False)
AUTO_PUBLICIZE = getattr(settings, 'KNOWLEDGE_AUTO_PUBLICIZE', False)
FREE_RESPONSE = getattr(settings, 'KNOWLEDGE_FREE_RESPONSE', True)
# alerts
ALERTS = getattr(settings, 'KNOWLEDGE_ALERTS', False)
ALERTS_FUNCTION_PATH = getattr(settings, 'KNOWLEDGE_ALERTS_FUNCTION_PATH',
'knowledge.signals.send_alerts')
# misc
SLUG_URLS = getattr(settings, 'KNOWLEDGE_SLUG_URLS', True) Notice something missing? Yup. No BASE_TEMPLATE = getattr(settings, 'KNOWLEDGE_BASE_TEMPLATE', 'django_knowledge/base.html') It looks like even though the author recommends using the stable release via pip, that DOES NOT have the custom template. Sloppy. You might like to clone the Git repo instead. That's what I am going to do. Good luck. |
After updating from Github directly: pip install -e git+https://github.com/zapier/django-knowledge.git#egg=django-knowledge This now works: % python manage.py shell
>>> from django.conf import settings
>>> from knowledge.settings import *
>>> print BASE_TEMPLATE
django_knowledge/base.html Like I said before... sloppy. |
We haven't pushed the recent updates to PyPi yet. |
Then (with respect as you are providing this for free, and thank you) you should really make a note of this on the readthedocs page at a minimum. Its pretty much a deal breaker for me, and probably other devs, if they can't apply their own chrome/skin to the app. |
Valid point, we definitely should. I'd be happy to accept a pull request that addresses some of this, as I can't devote time to cleaning up django-knowledge in the near short-term... 😦 |
That is also a valid point (that you can't devote time), and I am aware that open-source sometimes means extra 'features'. If I get time I will try and address some of this issues. Regards. |
One final comment on this. This project also assumes that your custom templates live in the global space under: For large Django projects the standard is to create per application template directories. So, if you have installed I did the latter as I have a very large Django project, and to make it work with my custom templates I had to create my own app if 'knowledge' in INSTALLED_APPS:
# Ugly hack. If we install django-knowledge via pip it is
# installed under site_packages, and the templates therein are used.
# However, we want to override this with our own templates, but not in
# the projects global templates directory due to keeping a clean house.
# So need to define a path that Django's built in
# Template Loaders can find. Use relative paths.
TEMPLATE_DIRS += (PROJECT_PATH + '/../knowledge/templates',)
KNOWLEDGE_BASE_TEMPLATE = 'django_knowledge/base.html' This is ugly, but it works. |
Thanks for the feedback and insight, I definitely appreciate it! Hopefully I'll get a rainy afternoon sometime and give our open source stuff some love and attention. 😄 |
Sorry, was traveling in Japan, so very late to this. :) Agreed that this fix needs to make its way upstream, but we wound up simply cloning the repo for now. |
We've been customizing the style of django-knowledge and were looking forward to using the KNOWLEDGE_BASE_TEMPLATE setting to avoid having to drop a custom build of all of django-knowledge into our source base. However, the KNOWLEDGE_BASE_TEMPLATE setting seems to be absent from the source.
Is this a setting that is in development, and the docs are too new? Or is this a depreciated setting and the docs need to be scrubbed? Thanks.
The text was updated successfully, but these errors were encountered: