bashu / django-easy-maps

🗺 Google Maps with easy!
MIT License
145 stars 56 forks source link

initialize_map_1 is not a function #73

Closed pascalvogel1992 closed 5 years ago

pascalvogel1992 commented 5 years ago

Sadly I can't get the app to work in my setup with Django 2.2. I receive the below error in the JavaScript console. Any ideas how to fix this?

App is in INSTALLED_APPS, EASY_MAPS_GOOGLE_KEY is set (nothing else).

My template basically looks like this:

{% load easy_maps_tags %}
{% easy_map "Russia, Ekaterinburg, Mira 32" 300 400 %}

Error message: image

Do I need to load Google Maps Javascript myself?

bashu commented 5 years ago

@pascalvogel1992 can you run example project https://github.com/bashu/django-easy-maps/tree/develop/example and tell me if error still occurs?

bashu commented 5 years ago

@pascalvogel1992 did you override "templates/easy_maps/map.html" ?

pascalvogel1992 commented 5 years ago

The example works. I did not override the template, should I?

pascalvogel1992 commented 5 years ago

Any ideas how I should go about debugging what in my setup is causing this?

bashu commented 5 years ago

@pascalvogel1992 you can, but not need to. Can you send me rendered HTML?

pascalvogel1992 commented 5 years ago
<!-- HTML map container -->
<div id="map-canvas-1"
class="easy-map-googlemap">
<!-- geocoding error -->
</div>

<script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyDahh4c5G8YZJih0vnKBKPo6EGMLAeaL-Q&language=en&callback=initialize_map_1" async defer></script>
jackton1 commented 5 years ago

@pascalvogel1992 Could you verify that the callback function is rendered on the page i.e This could be a case where the address isn't computed.

{% block map_js %}{% if map.computed_address %}
bashu commented 5 years ago

@pascalvogel1992 @jackton1 can you try it with new template from https://github.com/bashu/django-easy-maps/blob/develop/easy_maps/templates/easy_maps/map.html