Code Monkey home page Code Monkey logo

Comments (8)

erdem avatar erdem commented on August 17, 2024 8

I understand the issue. Your template doesn't have {{ form.media }} variable. Put {{ form.media }} variable to <head> tag or end of the <body> tag in your index.html. Then it should work.

Like here:
https://github.com/erdem/django-map-widgets/blob/master/example/templates/cities/form.html#L4

I missed this part when I was writing instructions. I will update the document soon.

Thank you for noticing me about that.

from django-map-widgets.

gabrielpiccolo4 avatar gabrielpiccolo4 commented on August 17, 2024 1

Hi @erdem, I tried many things and none worked... I also created a new app (Django 1.11) to test and the problem persists (django_1-11_maps-widget.zip). Maybe you can help me, my settings.py related to static-files are as follows:

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]

I'm just wondering, (please notice I'm a student studying the framework) the collectstatic isn't used just when the app is ready to deploy? 'Cause I'm yet using django's run server to test it.

Just a question, I'm not using PostgreSQL, I'm using MySQL, and my models ain't using the PointField, but CharFields (both for coordinates and city name), not sure if this can cause that error?

Thanks,
Gabriel

from django-map-widgets.

gabrielpiccolo4 avatar gabrielpiccolo4 commented on August 17, 2024 1

It worked! Thanks @erdem!

from django-map-widgets.

erdem avatar erdem commented on August 17, 2024

Hi @gabrielpiccolo4

It seems the static files not loaded in your project. Did you call python manage.py collectstatic?

You must copy the third-party packages static files into the STATIC_ROOT with collectstatic management command.

from django-map-widgets.

gabrielpiccolo4 avatar gabrielpiccolo4 commented on August 17, 2024

Hey @erdem thanks for answering back!

Sorry I missed this part of the tutorial. I ran the command collectstatic and Django successfuly coppied all the files, but the browsers yet say Reference Error.

The strange thing is that when I create the field with GoogleStaticMapWidget it loads the image <img src="/static/mapwidgets/images/no-map-image.png" class="no-map-image"> from the static folder. Also, all the js files are inside the static folder.

*The template has the tag {% load staticfiles %}

from django-map-widgets.

erdem avatar erdem commented on August 17, 2024

That image is a placeholder image for blank geo point fields. There is no input option for GoogleStaticMapWidget. The static widgets are read-only. If you need to input for geo point fields, you have to use GooglePointFieldWidget.

The static files issue must be fixed after the collectstatic command. If it is not sorted out, post your Django static app configuration in the project settings file.

Thanks

from django-map-widgets.

erdem avatar erdem commented on August 17, 2024

Hi @gabrielpiccolo4

I didn't try the widget with CharField, but it should work.

If you are working on the development mode, you must add static files serving view for the urls. I think you missed that part in your project.

Check out the links below:

https://docs.djangoproject.com/en/1.11/howto/static-files/#serving-static-files-during-development

https://github.com/erdem/django-map-widgets/blob/master/example/example/urls.py#L13

Thanks.

from django-map-widgets.

gabrielpiccolo4 avatar gabrielpiccolo4 commented on August 17, 2024

I missed this part in this new project I created, unfortunately no luck =(
Maybe is it something in my Windows? Could you try to run python manage.py runserver on the project below? The index page is using the widget.

django_1-11_maps-widget2.zip

Thanks Erdem, again, sorry to trouble you

from django-map-widgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.