Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looking for a bunch of js files in a missing static/src location #365

Open
kysevenle opened this issue May 17, 2023 · 5 comments
Open

Looking for a bunch of js files in a missing static/src location #365

kysevenle opened this issue May 17, 2023 · 5 comments

Comments

@kysevenle
Copy link

When loading a page it's trying to load a bunch of js files from a static/src directory.

static/src/core...
static/src/geometry...
static/src/control...
static/src/layer...
and others

I don't know why it is trying to load these files. I don't see anything in the documentation about why I should have a static/src directory.

I have a working page that loads a leaflet map, adds layer control, adds markers, and functions. However I am running into errors when adding new functionality. I'm not sure if these missing js files are causing it. To isolate what was trying to load these files I made a barebones page that all it does is loads leaflet_tags and leaflet_js which results in attempting to load all these js files.

Any help would be appreciated.

@Gagaro
Copy link
Member

Gagaro commented May 30, 2023

What are your statics and django-leaflets settings? What are the whole URLs?

@StarBrand
Copy link

I have the same issue with {% leaflet_js %}. Checking the templates folder where there is <script src="{% static "leaflet.js" %}"></script>, in my case, replace the static with my static source, which doesn't have a leaflet.js. Is this the expected behavior? Is there a way to specify the js source in the LEAFLET_CONFIG?

@Gagaro
Copy link
Member

Gagaro commented Nov 13, 2023

What do you mean by replace the static with my static source? Do you have the leaflet.js file in your collected statics files?

There is no setting to change the js file.

@StarBrand
Copy link

Not in my development environment, when my static files are served from the static folder. But, in production, I serve my statics from a cloud service (AWS S3, particularly) and the leaflet_js tag replace the tag with:

<script src="<s3-path>/leaflet/leaflet.js"></script>

So to upload files using the collectstatics django command, I copy the leaflet static files to my static source.

I would prefer to load those static from another CDN (like cdnjs) to avoid keeping a copy of those files, that was what I was asking.

@Gagaro
Copy link
Member

Gagaro commented Dec 11, 2023

There is currently no way to specify which JS to use.

Feel free to open a PR which add this possibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants