coderholic / django-cities

Countries and cities of the world for Django projects
MIT License
927 stars 371 forks source link

Django 1.10 compatibility: AttributeError: type object 'BaseCommand' has no attribute 'option_list'` #127

Closed dpmontero closed 8 years ago

dpmontero commented 8 years ago

Hi,

I'm tried django-cities in Django 1.10, when I executed python manage.py cities --import=all I had a problem of compatibility version of Django File "....../env/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 55, in Command option_list = BaseCommand.option_list + ( AttributeError: type object 'BaseCommand' has no attribute 'option_list'

blag commented 8 years ago

Should be fixed in 6998752f85242b8923973c7bc90eed50a7aa4a47. Can you test that by cloning this repo? That commit hasn't been pushed to PyPI yet. Thanks!

dpmontero commented 8 years ago

I continue with some problems:

  1. 124 Not exist CITIES_IGNORE_EMPTY_REGIONS in conf:

    File ".../env/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 40, in <module> from ...conf import CITIES_IGNORE_EMPTY_REGIONS ImportError: cannot import name CITIES_IGNORE_EMPTY_REGIONS

  2. When I commented the line 40 of with #from ...conf import CITIES_IGNORE_EMPTY_REGIONS, this is the next message: ./manage.py... or python manage.py cities --import=all usage: manage.py cities [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] manage.py cities: error: unrecognized arguments: --import=all

Thanks!!

blag commented 8 years ago

I think I've fixed the CITIES_IGNORE_EMPTY_REGIONS issue. Care to try again?

And I'm trying to add Travis CI tests to the repo so these sorts of issues don't keep popping up.

Thanks!

dpmontero commented 8 years ago

python manage.py cities --import=all usage: manage.py cities [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] manage.py cities: error: unrecognized arguments: --import=all

I had problems with branch versions, I thought it was fixed, but I continue with that problem. I think that not my configuration.

thanks!

blag commented 8 years ago

I won't be around a computer to look into this until Monday, but I'll try to dig into it then.

Can you post the full stacktrace for me?

Thanks!

dpmontero commented 8 years ago

1.- I replaced the files and directories with your repository master.

2.- Made migrations. First: python manage.py makemigrations, second: python manage.py migrate --fake cities. All correct.

3.- I executed python manage.py cities --import=all, the responsed message: usage: manage.py cities [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] manage.py cities: error: unrecognized arguments: --import=all

That is like not to reconize the command --import. Is it relationated with the change 6998752?

blag commented 8 years ago

You should NOT have to make migrations for Django-cities, that should already be done for you. There should be two migrations already created for you: 0001_initial and 0002_add continent_model_and_foreign_keys (or a similar name, I don't remember exactly what it is and I'm on mobile).

Additionally, unless you're upgrading from South, you shouldn't need to fake any of the migrations.

But that error, where it doesn't recognize the '--import' flag is rather weird. I'll have to dig into that on Monday. Thanks for the feedback!