Do you want a database which contains most of cities in the world as well as the countries? This app will save 2 collections to your mongodb:
cities
(23328 in total)countries
(252 in total)Even better, the
pymongo
python main.py
to generate the database from source datapython update.py
to update the source data from GeoNamessettings.py
currency symbol
which not included in the GeoNames (like $
for USD
)FAQ
part.setting.py
)settings.py
)git clone https://github.com/Mr-Binary/world-cities-mongodb.git
pip install pymongo
Open settings.py
, set up your database settings.
python main.py
Enjoy :)
data
folder: python update.py
[data]
: [Folder] Raw data from GeoNames[models]
: [Folder] database model for city and country[utils]
: [Folder] Helper functionsettings.py
: Settingsmain.py
: Main file to generate the databaseupdate.py
: Update the source data
from GeoNamesThe data is from GeoNames.
The cities
contains cities which population greater than 15000.
How to update the data
python update.py
The URL of source data from GeoNames:
save_cities()
and save_countries()
in mongodb.py
, then it will be called at run time with the list of data to insert.