I'm attempting to add a link to an icon I used to the footer of my doc page, but I can't seem to figure out how to copy this link. I'm following this tutorial but haven't had any luck. I've created a file _templates/layout.html:
{% extends "!layout.html" %}
{% block footer %}
<li>CC BY 3.0</li>
{{ super() }}
{% endblock %}
then in my conf.py I do
templates_path = ['_templates']
# ...
html_theme = 'sphinx_rtd_theme'
The problem is that when I build, nothing extra shows up in the footer of my page. I initially thought sphinx just wasn't finding my file, but if I change {% extends "!layout.html" %} to {% extends "layout.html" %} I get the error
Running Sphinx v1.3.1
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 30 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
preparing documents... done
writing output... [ 3%] dev/conventions
Exception occurred:
File "C:\...\Anaconda\lib\site-packages\jinja2\utils.py", line 389,
in __getitem__
if self._queue[-1] != key:
RuntimeError: maximum recursion depth exceeded in cmp
The full traceback has been saved in c:\...\appdata\local\temp\1\sphi
nx-err-tjhk_m.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message c
an be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphin
x/issues>. Thanks!
So I know sphinx see's my file, but it doesn't seem to write anything. What am I doing wrong?
The issue I ended up having was I was overwriting the wrong file, while layout.html did implement a footer block, it was not the block I was looking to add to. Instead sphinx_rtd_theme has a footer.html file, which I ended up overwriting instead and everything worked as intended.
Related
I have a problem with building Github page.
It is said that 'Your site is having problems building: The tag set on line 180 in Web_Optimizaion/node_modules/nunjucks/CHANGELOG.md is not a recognized Liquid tag. For more information, see https://help.github.com/articles/page-build-failed-unknown-tag-error/.'
I didn't make this error. It is just node_modules and I used it before but it was okay. Can you help me how I edit it?
Thanks,
This is the what happens:
https://github.com/leiachung41/leiachung41.github.io/blob/master/Web_Optimizaion/node_modules/nunjucks/CHANGELOG.md
This is line 180:
* Add support for `{% set %}` block assignments as in jinja2. Thanks Daniele
Rapagnani. Merge of [#656](https://github.com/mozilla/nunjucks/pull/656)
My guess is that the {% set %} bit is being parsed as Liquid. Is this what you intended? If not, you probably want to use the raw tag:
{% raw %}{% set %}{% endraw %}
You could also exclude the whole file from Jekyll processing by adding this to your _config.yml file:
exclude: ['Web_Optimizaion/node_modules/nunjucks/CHANGELOG.md']
More info here.
I am experiencing this strange error only on my production environment. It works fine locally and on staging.
I'm using Django==1.10.5 & django-blog-zinnia==0.18.1 with zinnia-wysiwyg-ckeditor==1.3. I believe this issue happened recently when we upgraded from Django==1.8 to the latest.
When I try to create a blog entry, I can't edit the content because the ckeditor instance does not load. The errors are:
https://example.com/admin/zinnia/entry/81/change/config.js/change/ 404 (Not Found)
https://example.com/admin/zinnia/entry/81/change/lang/en.js/change/
GET https://example.com/admin/zinnia/entry/81/change/skins/moono-lisa/editor.css/change/
Uncaught TypeError: Cannot set property 'dir' of undefined
The URL is /admin/zinnia/entry/81/change/
So this very much looks like ckeditor.js is trying to load additional static files based on the current URLs and somehow it injects the filenames into the current URL.
As a workaround, I ssh-ed into the server and manipulated /static/ckeditor/ckeditor/ckeditor.8bd276b5ef4c.js and added this line at the very top:
window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';
This solves the issue. The big question is: Why does this only happen on one of my machines, why does Django/zinnia not set CKEDITOR_BASEPATH correctly by itself?
I'm posting this here because I am not sure if this is an issue in Django, zinnia or zinnia-ckeditor, if anyone got insights on who is guilty, I'm happy to re-post this issue on the relevant issue tracker on github.
EDIT:
As a workaround, in my project I created the file templates/admin/change_form.html:
{% extends "admin/change_form.html" %}
{% block extrahead %}
<script>window.CKEDITOR_BASEPATH = '/static/ckeditor/ckeditor/';</script>
{{ block.super }}
{% endblock %}
I have a website with various js files, and i'm using django-compressor like so:
{% compress js %}
{% endcompress %}
{% compress js %}
{% endcompress %}
For some reason its only creating the FIRST js file. I have my app hosted on an EC2. I can see the first file there. The second file appears when I do a view source on the page, however, the file itself doens't exist (I get a 404 when I click on the link to the second js file). Is there anything I'm doing wrong? I have my settings as per below:
COMPRESS_ENABLED = not DEBUG
COMPRESS_PARSER = 'compressor.parser.BeautifulSoupParser'
COMPRESS_CSS_FILTERS = ['compressor.filters.cssmin.CSSMinFilter']
COMPRESS_JS_FILTERS = ['compressor.filters.jsmin.JSMinFilter']
It's working perfectly for css files...but failing on any other js file after the first compress flag...
I honestly have no idea what happened. this used to work perfectly, but randomly stopped out of no where! I did the following and it worked:
python manage.py compress --force
This basically forces it to compress all files; normally django-compressor ignores files that have not changed and have been compressed already.
I'm using Django 1.2.4 on Ubuntu 10.10. I'm trying to override the index.html template for the admin module. I've been following these instructions. I also looked at this question, but I'm still having difficulty.
The instructions say to create an admin directory in the templates directory:
templates/
admin/
index.html
I want to override a single block in the index.html. (Really, all I want to do is append some text to the end. Is there an easier way than copy/pasting the entire block and changing it?) (Update: Looks like {{block.super}} may help.)
To signal that I'm overriding, I put this at the top of my index.html:
{% extends "admin/index.html" %}
Of course, that results in a stack overflow (from the terminal):
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.RuntimeError'> ignored
What is the correct way to do this? I tried a symlink per an answer on the linked question, but that resulted in the following:
me#mycomp:~/foo$ sudo ln -s /usr/local/lib/python2.6/dist-packages/django/contrib/admin/templates/ django_admin
[sudo] password for me:
ln: creating symbolic link `django_admin': Protocol error
What am I doing wrong?
The recursion error is because you're extending the admin/index.html with itself.
You can either:
copy the entire admin/index.html template in your templates/admin/ directory, and it will replace the default template with yours
override the index.html per app or model, as explained here
I know this is late after the question, but you know, google traveling...
Amend settings.py with an extra template folder, for example:
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"/home/mysite/webapps/django/myproject/templates",
"/home/mysite/webapps/django/lib/python2.7/django/", # extra folder
)
Then in myproject/templates/admin add your own index.html like:
{% extends "contrib/admin/templates/admin/index.html" %}
{% block branding %}
<h1 id="site-name">Administration for TheLittleButtonCo</h1>
{% endblock %}
Variations are possible, obviously. This works on Django 1.3.1 final
Not sure if you found the answer, but you need to change
{% extends "admin/index.html" %}
to
{% extends "admin/base_site.html" %}
as that is what the original index.html page overwrites. Because the Django system searches your templates folder before using the default admin one, so in this case it finds the admin/index.html in your templates, then it's trying to extend itself with the extend (hence the recursion error).
For reference you can customise the base_site.html in you templates too, it extends base.html. The best thing to do is copy the original from:
/usr/local/lib/python2.6/dist-packages/django/contrib/admin/templates/
and paste it into your templates folder as a starting point
I use an extra package, called django-smart-extends
I am trying to install django-photologue. Everything seems ok, because I install and set up following the official guidelines. I have to upload some photos as examples. However, when viewing a photo or gallery details , then an error as follows:
Caught an exception while rendering: 'Photo' object has no attribute 'get_thumbnail_url'
I tried to remove the following code from the file photo_detail.html
{% if object.public_galleries %}
<h2>This photo is found in the following galleries:</h2>
<ol>
{% for gallery in object.public_galleries %}
<li>{%previous_in_gallery object gallery%} {{ gallery.title }} {%next_in_gallery object gallery%}</li>
{% endfor %}
</ol>
{% endif %}
No more errors, but pictures do not show up. If you click on the link will still lead to correct photographs to see. I think the problem in:
{{ object.get_display_url }}
It is totally not return any value.
Please help me solve this problem. Thanks!
Did you run python manage.py plinit after install and opt to create both a thumbnail and display photosize? These photosizes need to be defined in your database.
In other versions, you have to edit photologue/templates/photolog/tags/next_in_gallery.html and replace
{{ photo.get_thumbnail_url }}
with
{{ photo.thumbnail.url }}
Same for photologue/templates/photolog/tags/prev_in_gallery.html.
Honestly from looking at the source, it looks like a bug in the project. If you search the source, thumbnail doesn't seem to be a field within the Photo class (get_FIELD_url is an easy way to access an ImageField's url btw.) So I would recommend tinkering with the source or finding another project. I might be wrong though but that's what my ~5 minute scan of the project found.