Closed Sarthak77tiwari closed 4 years ago
@Sarthak77tiwari Your project static view not well configured.
https://docs.djangoproject.com/en/dev/howto/static-files/
After getting the tons of your messages from all platforms, I tested the widgets with latest version django views to make sure it works fine. There is no issue. Your django project has problems, not the widget.
Also, read this; https://stackoverflow.com/help/how-to-ask
my project map image not found i have run python manage.py collectstatic my settings.py ` import os
if os.name == 'nt': import platform
`BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))
SECRET_KEY = '*judq@g52ok2&b2(u6ibif$=s^#z=%kjembjkes2dini2x_0w$' GOOGLE_MAP_API_KEY = 'AIzaSyAsFJ2MtCH2UXxTNPQAKvH_GdyRYqW3U1k' MAP_WIDGETS = { "GooglePointFieldWidget": ( ("zoom", 15), ("mapCenterLocationName", "london"), ), "GOOGLE_MAP_API_KEY": ""
}
DEBUG = True
ALLOWED_HOSTS = []`
`INSTALLED_APPS = [
]`
MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ]
`ROOT_URLCONF = 'llife.urls'
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ]`
WSGI_APPLICATION = 'llife.wsgi.application'
DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'geodjangodb', 'USER': 'geo_admin', 'PASSWORD': 'geoadmin', 'HOST': 'localhost', 'PORT': '5432', } }
AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ]
LANGUAGE_CODE = 'en-us'
`TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True`
STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static') ]
model.pyfrom django.contrib.gis.db import models class shop(models.Model): name = models.CharField(max_length=80, serialize=True) address = models.CharField(max_length=80, serialize=True) distance = models.PositiveIntegerField() location = models.PointField()
form.py `from django.contrib.gis import forms from mapwidgets.widgets import GooglePointFieldWidget from .models import shop class shopAdminForm(forms.ModelForm): class Meta: model = shop fields = 'all' widgets = { 'location': GooglePointFieldWidget,views.py `from django.shortcuts import render from .forms import *
def shopview(request):
form.html `{% load static%}