I saw this post on how to run a python script from django: http://www.djangotutsme.com/how-to-run-python-script-from-django/
I tried the example but get the following error when running python manage.py runscript myscript
.
I have Python 2.7, Django 1.10 and django extensions 1.6.1 installed.
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/site-packages/Django-1.10.dev20151201151517-py2.7.egg/django/core/management/__init__.py", line 349, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/site-packages/Django-1.10.dev20151201151517-py2.7.egg/django/core/management/__init__.py", line 341, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/Django-1.10.dev20151201151517-py2.7.egg/django/core/management/__init__.py", line 193, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/lib/python2.7/site-packages/Django-1.10.dev20151201151517-py2.7.egg/django/core/management/__init__.py", line 40, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/lib/python2.7/site-packages/django_extensions-1.6.1-py2.7.egg/django_extensions/management/commands/runscript.py", line 6, in <module>
from django_extensions.management.email_notifications import \
File "/usr/lib/python2.7/site-packages/django_extensions-1.6.1-py2.7.egg/django_extensions/management/email_notifications.py", line 10, in <module>
class EmailNotificationCommand(BaseCommand):
File "/usr/lib/python2.7/site-packages/django_extensions-1.6.1-py2.7.egg/django_extensions/management/email_notifications.py", line 49, in EmailNotificationCommand
**option_list = BaseCommand.option_list + (
AttributeError: type object 'BaseCommand' has no attribute 'option_list'**
Any idea what the problem is? Is this a bug in django?
BaseCommand.option_list
is deprecated in Django 1.8 and removed in Django 1.10. It looks like Django-extensions has been updated, but there hasn't been a new release since then.
You could try installing django-extensions from the master branch, but it would be a better idea to use the latest release of Django, currently 1.9.2. Django 1.10 has not been released yet, and is still under development.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With