Django 运行python manage.py时,迁移获取值错误:字符串输入无法识别为WKT EWKT和HEXEWKB

Django 运行python manage.py时,迁移获取值错误:字符串输入无法识别为WKT EWKT和HEXEWKB,django,geodjango,Django,Geodjango,当我进行manage.py迁移时,我成功地进行了迁移,但当我运行manage.py迁移时 我是新手,詹戈,请帮帮我 设置.py 在models.py中 将此应用于获取欢迎表python manage.py ogrinspect repoter/data/TM_WORLD_BORDERS-0.3.shp welcome--srid=4326--multi--mapping 在loader.py中 错误:应用迁移时迁移成功完成 C:\Users\hp\Desktop\googlemaps\agric

当我进行manage.py迁移时,我成功地进行了迁移,但当我运行manage.py迁移时

我是新手,詹戈,请帮帮我

设置.py 在models.py中 将此应用于获取欢迎表python manage.py ogrinspect repoter/data/TM_WORLD_BORDERS-0.3.shp welcome--srid=4326--multi--mapping 在loader.py中 错误:应用迁移时迁移成功完成
C:\Users\hp\Desktop\googlemaps\agricon>python manage.py makemigrations
未检测到任何更改
C:\Users\hp\Desktop\googlemaps\agricon>python manage.py迁移
要执行的操作:
应用所有迁移:管理、身份验证、contenttypes、repoter、会话
运行迁移:
正在应用repoter.0002\u auto\u 20190825\u 1454…回溯(最近调用
最后):
文件“manage.py”,第21行,在
main()
文件“manage.py”,第17行,主
从命令行(sys.argv)执行命令
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\core\management\\ uuuu init\uuuuu.py”,第381行,在
从命令行执行命令
utility.execute()
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
文件包\django\core\management\\ uuuuu init\uuuuuu.py“,第375行,执行
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\core\management\base.py”,第323行,运行于\u argv
self.execute(*args,**cmd_选项)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
文件包\django\core\management\base.py”,执行中的第364行
输出=self.handle(*args,**选项)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\core\management\base.py”,第83行,包装
res=句柄函数(*args,**kwargs)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
handle中的packages\django\core\management\commands\migrate.py”,第234行
假首字母=假首字母,
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\migrations\executor.py”,在migrate中的第117行
state=self.\u迁移\u所有\u转发(state,plan,full\u plan,fake=fake,
假首字母=假首字母)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\migrations\executor.py”,第147行,在
_向前迁移所有对象
state=self.apply\u迁移(state,migration,false=false,
假首字母=假首字母)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\migrations\executor.py”,第245行,在apply\u migration中
state=migration.apply(状态,模式编辑器)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\migrations\migration.py”,第124行,应用
操作。数据库转发(self.app\u标签、模式编辑器、旧状态、,
项目(州)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\migrations\operations\fields.py”,第112行,在
数据库转发
领域
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\backends\base\schema.py”,第433行,在add\u字段中
定义,params=self.column\u sql(模型,字段,include\u默认值=True)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\backends\base\schema.py”,第161行,在sql列中
默认值=自生效默认值(字段)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\backends\base\schema.py”,第233行,在
有效违约
返回字段。获取\u数据库\u准备\u保存(自生效\u默认值(字段),
自我连接)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\models\fields\\ uuuuu init\ uuuuuuu.py”,第789行,在
获取\u db\u准备\u保存
返回self.get_db_prep_值(值,连接=连接,
准备就绪(错误)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\contrib\gis\db\models\fields.py”,第147行,在
获取\u db\u prep\u值
super().get_db_prep_值(值、连接、*args、**kwargs),
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\db\models\fields\\uuuu init\uuuuu.py”,第784行,在
获取\u db\u prep\u值
value=self.get\u prep\u值(value)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\contrib\gis\db\models\fields.py”,第186行,在
获取_prep_值
obj=几何图形(obj)
文件“C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site-
packages\django\contrib\gis\geos\geometry.py”,第715行,在__
raise VALUERROR('无法识别为WKT EWKT和HEXEWKB的字符串输入')
ValueError:字符串输入无法识别为WKT EWKT和HEXEWKB。

我已经删除了我创建的所有迁移,并再次创建了新迁移,然后它工作并获得了输出

任何一个帮助我已经删除了我创建的所有迁移,并再次创建了新迁移,然后它工作并获得了输出
import os
if os.name=='nt':
   import platform
   OSGEO4W=r"C:\OSGeo4w"
   if '64' in platform.architecture()[0]:
        OSGEO4W+="64"
   assert os.path.isdir(OSGEO4W), "Directory does not exist:"+OSGEO4W
   os.environ['OSGEO4W_ROOT']=OSGEO4W
   os.environ['GDAL_DATA']=OSGEO4W+r"\share\gdal"
   os.environ['PROJ_LIB']=OSGEO4W+r"\share\proj"
   os.environ['PATH']=OSGEO4W+r"\bin;"+os.environ['PATH']

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

SECRET_KEY = '+2r35-w0_kqcr4ygbt474-!xx9q9izus$-+)g)%(-+=8d*^1pt'

DEBUG = False

ALLOWED_HOSTS = []
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'leaflet',
'repoter',
 ]

 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 = 'agricon.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 = 'agricon.wsgi.application'

 DATABASES = {
 'default': {

    'ENGINE': 'django.contrib.gis.db.backends.postgis',
    'NAME': 'postgis_25_sample',
    'USER': 'postgres',
    'PASSWORD': 'Shanmukhavarma99@',
    'HOST': 'localhost',
    'PORT': '5432',
 }
 }

 GEOS_LIBRARY_PATH = r'C:\\OSGeo4W\\bin\\geos_c.dll' 
 GDAL_LIBRARY_PATH = r'C:\OSGeo4W\\bin\\gdal204.dll'


 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/'
LEAFLET_CONFIG={
'DEFAULT_ZOOM':1,
'MAX_ZOOM':30,
'MIN_ZOOM':10,
'SCALE':'both',
 }
  from django.db import models

  from django.contrib.gis.db import models

  class incides(models.Model):
     name=models.CharField(max_length=100)
     location=models.PointField(srid=4326)
     def __str__(self):
       return self.name
     class Meta:
       verbose_name_plural='incides'


  class welcome(models.Model):
      fips = models.CharField(max_length=20)
      iso2 = models.CharField(max_length=20)
      iso3 = models.CharField(max_length=3)
      un = models.IntegerField()
      name = models.CharField(max_length=50)
      area = models.IntegerField()
      pop2005 = models.BigIntegerField()
      region = models.IntegerField()
      subregion = models.IntegerField()
      lon = models.FloatField()
      lat = models.FloatField()
      geom = models.MultiPolygonField(srid=4326)

      def __str__(self):
        return 'Name: %s' % self.fips
   import os

   from django.contrib.gis.utils import LayerMapping
   from .models import welcome
   welcome_mapping = {
   'fips': 'FIPS',
   'iso2': 'ISO2',
   'iso3': 'ISO3',
   'un': 'UN',
   'name': 'NAME',
   'area': 'AREA',
   'pop2005': 'POP2005',
   'region': 'REGION',
   'subregion': 'SUBREGION',
   'lon': 'LON',
   'lat': 'LAT',
   'geom': 'MULTIPOLYGON',
   }


   welcome_shp=os.path.abspath(os.path.join(os.path.dirname("C:\\Users\\hp
   \\Desktop\\googlemaps\\agricon\\repoter\\data"), 'data', 
   'TM_WORLD_BORDERS-0.3.shp'),)
   def run(verbose=True):
       ln=LayerMapping(welcome,welcome_shp,welcome_mapping,
       transform=False,encoding='iso-8859-1')
       ln.save(strict=True,verbose=verbose)
C:\Users\hp\Desktop\googlemaps\agricon>python manage.py makemigrations
No changes detected
C:\Users\hp\Desktop\googlemaps\agricon>python manage.py migrate
Operations to perform:
   Apply all migrations: admin, auth, contenttypes, repoter, sessions
Running migrations:
Applying repoter.0002_auto_20190825_1454...Traceback (most recent call 
last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\core\management\__init__.py", line 381, in 
execute_from_command_line
utility.execute()
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\core\management\base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\core\management\commands\migrate.py", line 234, in handle
fake_initial=fake_initial,
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\migrations\executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, 
fake_initial=fake_initial)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\migrations\executor.py", line 147, in 
_migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, 
fake_initial=fake_initial)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\migrations\executor.py", line 245, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\migrations\migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, 
project_state)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\migrations\operations\fields.py", line 112, in 
database_forwards
field,
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\backends\base\schema.py", line 433, in add_field
definition, params = self.column_sql(model, field, include_default=True)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\backends\base\schema.py", line 161, in column_sql
default_value = self.effective_default(field)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\backends\base\schema.py", line 233, in 
effective_default
return field.get_db_prep_save(self._effective_default(field), 
self.connection)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\models\fields\__init__.py", line 789, in 
get_db_prep_save
return self.get_db_prep_value(value, connection=connection, 
prepared=False)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\contrib\gis\db\models\fields.py", line 147, in 
get_db_prep_value
super().get_db_prep_value(value, connection, *args, **kwargs),
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\db\models\fields\__init__.py", line 784, in 
get_db_prep_value
value = self.get_prep_value(value)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\contrib\gis\db\models\fields.py", line 186, in 
get_prep_value
obj = GEOSGeometry(obj)
File "C:\Users\hp\AppData\Local\Programs\Python\Python37-32\lib\site- 
packages\django\contrib\gis\geos\geometry.py", line 715, in __init__
raise ValueError('String input unrecognized as WKT EWKT, and HEXEWKB.')
ValueError: String input unrecognized as WKT EWKT, and HEXEWKB.