Hi, 

I have a site that has been running off various versions of Mezzanine 
successfully for years. Now, with the latest Django security patch and the 
upcoming end of support for Django v1.8 we are trying to upgrade the site 
to run off the next Django LTS release, v1.11. However I'm getting the 
following error from the site admin when trying to run the site;
    
AttributeError: 'module' object has no attribute 'site'

which seems to be triggered by the *admin.site.unregister* and 
*admin.site.register* statements in admin.py.

We are using the *EXTRA_MODEL_FIELDS* setting to inject extra fields into 
the Blog & Forms apps. This has worked fine for years but after the upgrade 
I can't start the django dev server, here is the traceback from the 
manage.py check command;

Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_from_command_line(sys.argv)
  File 
"/Users/t/env/python2/mini-1-11/lib/python2.7/site-packages/django/core/management/__init__.py"
, line 364, in execute_from_command_line
    utility.execute()
  File 
"/Users/t/env/python2/mini-1-11/lib/python2.7/site-packages/django/core/management/__init__.py"
, line 338, in execute
    django.setup()
  File 
"/Users/t/env/python2/mini-1-11/lib/python2.7/site-packages/django/__init__.py"
, line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File 
"/Users/t/env/python2/mini-1-11/lib/python2.7/site-packages/django/apps/registry.py"
, line 116, in populate
    app_config.ready()
  File 
"/Users/t/env/python2/mini-1-11/lib/python2.7/site-packages/django/contrib/admin/apps.py"
, line 23, in ready
    self.module.autodiscover()
  File 
"/Users/t/env/python2/mini-1-11/lib/python2.7/site-packages/mezzanine/boot/__init__.py"
, line 114, in autodiscover
    django_autodiscover(*args, **kwargs)
  File 
"/Users/t/env/python2/mini-1-11/lib/python2.7/site-packages/django/contrib/admin/__init__.py"
, line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File 
"/Users/t/env/python2/mini-1-11/lib/python2.7/site-packages/django/utils/module_loading.py"
, line 50, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File 
"/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py"
, line 37, in import_module
    __import__(name)
  File 
"/Users/t/workspace/web/sites/mini/mez-4.2.3-test/mez_test/mez_test/custom/admin.py"
, line 64, in <module>
    admin.site.unregister(BlogPost)
AttributeError: 'module' object has no attribute 'site'



Here's what I've done so far;
I created a new virtualenv with Django v1.11 and Mezzanine v4.2.3 (I have 
tried the latest from the Mezzanine master branch too). I have updated the 
website codebase to be compatible with Django v1.11. 

I have also replicated this issue by creating a new blank Mezzanine project 
with no modifications other than 4 fields injected into the Blog app via 
EXTRA_MODEL_FIELDS and made available in the admin by sub-classing the 
re-registering the admin class as per the docs;
http://mezzanine.jupo.org/docs/model-customization.html
this results in the same traceback as above. If I comment out the 
unregister and register lines the dev server runs, but obviously without 
the admin customisation.

I am unsure what is causing this and any pointers would be appreciated.

Thanks,
Tom.

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to