oTree Forum >

Script not updating

#1 by Trontatuma

I put my javascript functions in a folder _static/javascript. Then I load them like below. 

When I do this, the function does not update anymore. When I do devserver, I still get the old version of the function. I have been having a similar issue also with static files. Anybody knows what could be the issue?

{% extends "global/Page.html" %}
{% load otree static %}

{% block styles %}
    {% include '_templates/styles/page_style.html' %}
{% endblock %}

{% block content %}
    {% include '_templates/includes/page_view.html' %}
{% endblock %}

{% block scripts %}
    <script type="text/javascript" src="{% static 'javascript/someFunction.js' %}"></script>
{% endblock %}

#2 by ccrabbe

Hi Trontatuma -

This could be several things.  I've noticed that whatever devserver does to notice that project files have changed to trigger an auto-restart doesn't always work with static files, so that could be the cause of the behavior you're seeing.  If you're not restarting devserver manually, I'd try that.

It also could be that your browser is shallow-refreshing the page and not re-downloading the linked .js files or static image files, so I'd try hard-refreshing by clearing your browser cache, or using shift-f5 if in Chrome.

Good luck,

#3 by Trontatuma

Yes, hard-refreshing helps! I changed the settings in my browser to do that on every start. Thanks for the tips!

Write a reply

Set forum username