'NoneType' object has no attribute 'run'
EmadMokhtar opened this issue · 1 comments
I set up a wizard to import a CSV file into my project. I used the default settings.
I register a drf serializer not Django model.
Python version: 2.7.13
Django version: 1.8.7
Data Wizard version: 1.2.0
URL: http://localhost:8000/datawizard/7/auto/
Error: {"error": {"message": "'NoneType' object has no attribute 'run'"}}
Settings:
DATA_WIZARD = {
'BACKEND': 'data_wizard.backends.threading',
'LOADER': 'data_wizard.loaders.FileLoader',
'PERMISSION': 'rest_framework.permissions.IsAdminUser',
}
I also tried 'data_wizard.backends.immediate'
I'm assuming the issue with backend.run()
def run_task(self, name, use_async=False, post=None,
backend=None, user=None):
if not backend:
backend = data_wizard_backend
if not user:
user = self.user
return backend.run(
name, self.pk, user.pk, use_async, post,
)
I was finally able to replicate this issue. It can happen if data_wizard.views
is imported before data_wizard.apps.WizardConfig.ready()
is called. For example, this can happen if "wq.db.rest"
is listed in INSTALLED_APPS
before "data_wizard"
.
For the next release, I updated data_wizard.views
to make it less dependent on import order. To work around this issue for now, try moving "data_wizard"
to an earlier position in your INSTALLED_APPS
.