Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type object 'BaseCommand' has no attribute 'option_list' #14

Open
Ecozzo opened this issue Jan 12, 2018 · 1 comment
Open

type object 'BaseCommand' has no attribute 'option_list' #14

Ecozzo opened this issue Jan 12, 2018 · 1 comment

Comments

@Ecozzo
Copy link

Ecozzo commented Jan 12, 2018

I'm in Django 2.0.1.
After removing migrations and making new migration everything is ok and the admin page work.
When running python manage.py stream I get the error
File "/mysite/twitter_stream/management/commands/stream.py", line 46, in Command
option_list = BaseCommand.option_list + (
AttributeError: type object 'BaseCommand' has no attribute 'option_list'
Looking around I understand that BaseCommand.option_list was deprecated in Django 1.8 and removed in Django 1.10. I also understand it was fixed, but I don't realize how to change it here.
Any idea?

@michaelbrooks
Copy link
Owner

That makes sense - I haven't used Django 2 so unfortunately I can't give you much direct advice, but you might be able to rewrite the option parsing to use the argparse module instead of optparse.

There's some info in the guide here: https://docs.djangoproject.com/en/2.0/howto/custom-management-commands/#accepting-optional-arguments

By the way, if you manage to get this working I would love to take a pull request with your improvements!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants