Pablo Alejandro
Pablo Alejandro

Reputation: 597

cities_light don't have all the cities in my country? DJANGO

I would like to know how to load all the data in cities_light of Django, I have 42 record when I run python manage.py cities_light --force-import-all or python manage.py cities_light

in settings

CITIES_LIGHT_TRANSLATION_LANGUAGES = ['es']
CITIES_LIGHT_INCLUDE_COUNTRIES = ['CR']

This return 42 records in /cities but I need more than 100

I would like to know how charge more records in the database becouse I have so much code to change if I change cities_light for another library. I thought that I could make a script for charge the rest of the records for instance a csv, but I need the obligatory fields in the database.

Thanks so much for your help.

Upvotes: 1

Views: 783

Answers (2)

Am Ben
Am Ben

Reputation: 119

Try to use the http://download.geonames.org/export/dump/[Country_Code].zip It's the only way I found to load more cities.

You may need to update the CITIES_LIGHT_INCLUDE_CITY_TYPES variable see http://www.geonames.org/export/codes.html.

I Hope that this will help someone because it took me sometime to figure all this out

Upvotes: 0

C14L
C14L

Reputation: 12548

Cities Light uses the open Geonames database. So it only knows the cities that are in the Geonames database. You can help and add missing cities there or fix the data on existing entries.

Also, there are different data files for cities from Geonames.

  • cities1000.zip has all cities with a population >1000
  • cities5000.zip all cities with a population >5000
  • cities15000.zip all cities with a population >15000

So maybe you are importing the smallest file that includes only larger towns and cities.

Upvotes: 1

Related Questions