Skip to content

Add support for Django 1.9 #21

@edmorley

Description

@edmorley

#20 will shortly add Django 1.9 to the Travis run, but marked as allowed to fail, since the tests are currently failing, eg:

https://travis-ci.org/kumar303/hawkrest/jobs/101117531

py27-django1.9-drf3.3 runtests: commands[0] | /home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/bin/python runtests.py

nosetests --logging-clear-handlers --with-nicedots --verbosity=1

Traceback (most recent call last):
  File "runtests.py", line 19, in <module>
    main()
  File "runtests.py", line 15, in main
    failures = test_runner.run_tests(sys.argv[1:])
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/django_nose/runner.py", line 403, in run_tests
    result = self.run_suite(nose_argv)
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/django_nose/runner.py", line 329, in run_suite
    django.setup()
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/opt/python/2.7.9/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/travis/build/kumar303/hawkrest/hawkrest/__init__.py", line 17, in <module>
    from rest_framework.authentication import BaseAuthentication
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/rest_framework/authentication.py", line 13, in <module>
    from rest_framework.authtoken.models import Token
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/rest_framework/authtoken/models.py", line 16, in <module>
    class Token(models.Model):
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
    self.check_apps_ready()
  File "/home/travis/build/kumar303/hawkrest/.tox/py27-django1.9-drf3.3/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

This appears to be due to Django 1.9 now not allowing models to be imported in __init__.py, per:
https://docs.djangoproject.com/en/1.7/internals/deprecation/#deprecation-removed-in-1-9

All models will need to be defined inside an installed application or declare an explicit app_label. Furthermore, it won’t be possible to import them before their application is loaded. In particular, it won’t be possible to import models inside the root package of their application.

However due to a bug, the deprecation warning for this wasn't shown when using previous versions of Django, otherwise the failure mode would have been more clear:
https://code.djangoproject.com/ticket/25477

Whilst hawkrest doesn't have any models itself, it imports several rest_framework classes which do import some of the rest_framework's models.

Once support for Django 1.9 is added, the allow_failure lines in .travis.yml can be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy