2016-10-25 3 views
0

manage.py cities --import=allでデータをインポートできないのですが、なぜこのようなことが起こっているのかわかりません。ここでは、ログは次のとおりです。Django Citiesインポートエラー

Traceback (most recent call last): 
    File "manage.py", line 10, in <module> 
    execute_from_command_line(sys.argv) 
    File "/home/julian/.virtualenvs/duenio/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line 
    utility.execute() 
    File "/home/julian/.virtualenvs/duenio/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/home/julian/.virtualenvs/duenio/local/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv 
    self.execute(*args, **cmd_options) 
    File "/home/julian/.virtualenvs/duenio/local/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute 
    output = self.handle(*args, **options) 
    File "/home/julian/.virtualenvs/duenio/local/lib/python2.7/site-packages/django/utils/decorators.py", line 184, in inner 
    return func(*args, **kwargs) 
    File "/home/julian/.virtualenvs/duenio/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 86, in handle 
    func() 
    File "/home/julian/.virtualenvs/duenio/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 312, in import_city 
    uptodate = self.download_once('city') 
    File "/home/julian/.virtualenvs/duenio/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 159, in download_once 
    self.download_cache[filekey] = self.download(filekey, i) 
    File "/home/julian/.virtualenvs/duenio/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 119, in download 
    filepath = os.path.join(self.data_dir, filename) 
    File "/home/julian/.virtualenvs/duenio/lib/python2.7/posixpath.py", line 75, in join 
    if b.startswith('/'): 
AttributeError: 'list' object has no attribute 'startswith' 

これらは都市の設定(私はPostGISのがインストールされている)です:奇妙な部分は、私は新しい新鮮なプロジェクトでのジャンゴ - 都市をインストールし、そしてそれがなかった、ある

DATABASES['default']['ENGINE'] = 'django.contrib.gis.db.backends.postgis' 

... 

CITIES_FILES = { 
    'city': { 
     'filename': ['CO.zip',], 
     'urls':  ['http://download.geonames.org/export/dump/'+'{filename}'] 
    }, 
} 

作業。あなたはこれを修正する方法を知っていますか?

答えて

1

ファイルのリストを提供するときは、代わりにfilenamefilenamesを使用する必要があります。

CITIES_FILES = { 
    'city': { 
     'filenames': ['CO.zip',], 
     'urls':  ['http://download.geonames.org/export/dump/'+'{filename}'] 
    }, 
} 

または代わり:https://github.com/coderholic/django-cities

+0

マンのConfigurationセクションの

CITIES_FILES = { 'city': { 'filename': 'CO.zip', 'urls': ['http://download.geonames.org/export/dump/'+'{filename}'] }, } 

詳細を、IそれはOKだったと私はそれに注意を払っていないと思った。ありがとう! –

関連する問題