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

12th Apr 2020, 5:26 AM
rahim
rahim - avatar
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/
12th Apr 2020, 6:19 AM
Gordon
Gordon - avatar
0
I have this line and other static files like as CSS and Bootstrap are served correctly.
12th Apr 2020, 6:22 AM
rahim
rahim - avatar
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>
12th Apr 2020, 6:32 AM
Gordon
Gordon - avatar
0
Gordon double quotes did not change the situation
12th Apr 2020, 6:53 AM
rahim
rahim - avatar
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.
12th Apr 2020, 7:02 AM
rahim
rahim - avatar