coderholic / django-cities

Countries and cities of the world for Django projects
MIT License
920 stars 374 forks source link

Multiple city import not working #189

Closed ScottEAdams closed 6 years ago

ScottEAdams commented 6 years ago

Checklist

Steps to reproduce

As per the docs use filenames instead of filename and use an iterable (have tried all the obvious combinations.

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

python manage.py cities --import city

Expected behavior

Import!

Actual behavior

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/project/lib/python3.5/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/project/lib/python3.5/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/project/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/project/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/Users/scott/.pyenv/versions/3.5.0/lib/python3.5/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/project/lib/python3.5/site-packages/cities/management/commands/cities.py", line 160, in handle
    func()
  File "/project/lib/python3.5/site-packages/cities/management/commands/cities.py", line 461, in import_city
    self.download('city')
  File "/project/lib/python3.5/site-packages/cities/management/commands/cities.py", line 177, in download
    filename = settings.files[filekey]['filename']
KeyError: 'filename'