This time with a plain text traceback. Sorry about that.

On 19/09/2017 3:22 PM, Mike Dewhirst wrote:
Ubuntu 16.04 dedicated staging server, Django 1.10.8, Python 2.7

Collectstatic has been working forever on this machine driven by Buildbot during a complete site deletion and recreation from scratch. I must have changed something but I can't think what.

It appears that Django tries to import mock and passes silently if it doesn't exist. I don't have mock on my Windows dev machine and collectstatic works fine.

I upgraded mock to 2.0.0 which also upgraded pbr to 3.1.1 and six to 1.11.0 but still get the same fail. See command and trace below.

I attended a mock session at PyConAu recently and decided never to use it (personally:) so it is maybe/possibly worthwhile uninstalling?

Does anyone have any advice?

Thanks

Mike

/usr/bin/python /var/www/ssds/manage.py collectstatic --settings=ssds.settings.staging --noinput



Traceback (most recent call last):
  File "/var/www/ssds/manage.py", line 24, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 341, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 199, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/var/www/ssds/billing/models/__init__.py", line 7, in <module>
    from .fee import Fee
  File "/var/www/ssds/billing/models/fee.py", line 9, in <module>
    from company.models import RelationshipType
  File "/var/www/ssds/company/models/__init__.py", line 12, in <module>
    from .relationship import Relationship
  File "/var/www/ssds/company/models/relationship.py", line 12, in <module>
    from common.utils import when
  File "/var/www/ssds/common/utils.py", line 18, in <module>
    from django.test import TestCase  # all tests import unittest from here
  File "/usr/local/lib/python2.7/dist-packages/django/test/__init__.py", line 27, in <module>
    import mock  # NOQA
  File "/usr/lib/python2.7/dist-packages/mock/__init__.py", line 2, in <module>
    import mock.mock as _mock
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 71, in <module>
    _v = VersionInfo('mock').semantic_version()
AttributeError: 'VersionInfo' object has no attribute 'semantic_version'




Looks like collectstatic is triggering all sorts of imports including my 'common' app which has no models and no static items but does import TestCase from django.test and that's where the mock import happens.

I guess I should read Django 1.10 release notes ...

Mike



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1af5599d-4292-6454-1b63-b2d4be352f1d%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to