Mike Dewhirst
unread,Sep 19, 2017, 1:23:01 AM9/19/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
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 our 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