简体   繁体   English

更改页面时Django源文件未更新

[英]Django source files not updating when changing pages

Using Django 1.11 with Viewflow-Pro 1.04 结合使用Django 1.11和Viewflow-Pro 1.04

This is probably a very simple question, but I've spent hours googling and reading and have come up completely empty. 这可能是一个非常简单的问题,但是我花了数小时在谷歌上搜索和阅读,但完全没有内容。

Each page of my app has various CSS/javascript files that it loads with script and link tags. 我的应用程序的每个页面都有各种CSS / javascript文件,可通过脚本和链接标签加载该文件。 However, when a user clicks a link and it redirects them to another page, the source isn't refreshed - it is still using the source from the previous page (which is often similar, but not the same). 但是,当用户单击链接并将其重定向到另一个页面时,不会刷新源-它仍在使用上一页的源(通常是相似的,但不相同)。

Refreshing the page fixes it, as it pulls the correct source. 刷新页面可以解决此问题,因为它可以拉出正确的源。 But basically I'm having to refresh the page every time I get redirected to a new page. 但是基本上,每次重定向到新页面时,我都必须刷新页面。

This has proven hard to debug, since a lot of pages have the same source and so they "seem" to work correctly - but I think it only happens with links. 事实证明,这很难调试,因为许多页面具有相同的来源,因此它们“似乎”可以正常工作-但我认为这仅在链接中发生。 If my view.py redirects users (using return render or similar) then it doesn't happen. 如果我的view.py重定向用户(使用return render或类似方法),则不会发生。 It is just if a user clicks a link to jump from one part of my site to another. 就像用户单击链接从我的网站的一部分跳到另一部分一样。

Anyone have a clue what it could be? 有人知道这可能是什么吗? I would include code samples, but it's affecting my entire project - if some specific code would be helpful let me know. 我将包含代码示例,但这会影响我的整个项目-如果某些特定的代码会有所帮助,请告诉我。

This is an example of what one of my links looks like: 这是我的链接之一的示例:

<a href="{% url 'dashboard:MOC_edit' MOC.id %}">{{ MOC }}</a>

Thanks for any help. 谢谢你的帮助。

Viewflow uses Django-Material frontend with Turbolinks to manage page scripts. Viewflow将Django材质前端与Turbolinks结合使用来管理页面脚本。

To adapt your page for Turbolinks ensure that scripts located in the <head> of a document. 要使页面适合Turbolink,请确保脚本位于文档的<head>中。 And 'turbolinks:load' event used to initialize it. 和'turbolinks:load'事件用于初始化它。

Ex: https://github.com/viewflow/viewflow/blob/master/viewflow/frontend/static/viewflow/js/viewflow.js 例如: https//github.com/viewflow/viewflow/blob/master/viewflow/frontend/static/viewflow/js/viewflow.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM