0
There JS models does not load in Django
I could not load three JS model in django app. The details are here: https://stackoverflow.com/questions/61167200/load-three-js-model-with-gltf-loader-in-django
6 Réponses
+ 1
In your settings file, define STATIC_URL, for example:
STATIC_URL = '/static/'
https://docs.djangoproject.com/en/3.0/howto/static-files/
0
I have this line and other static files like as CSS and Bootstrap are served correctly.
0
Try
<script>
var address_to_model ="{% static "models/matilda/scene.gltf" %}"; // Pass this variable to .js file
</script>
<script src="{% static "js/matilda.js" %}"></script>
0
Gordon double quotes did not change the situation
0
Mirielle The problem is not in naming system because Django could find and load my .js file correctly so I don't have any Django error. I think the problem is in gltf loader:
"loader.load( address_to_model, function ..."
This loader expects that the model should be in this address "localhost:8000/{{ address_to_model }}" but does not load anything.
There is not any Django error and model does not load.