Skip to content

Instantly share code, notes, and snippets.

@amotoki
Created May 11, 2018 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amotoki/65f08c00393e814776a3e450ccdd197d to your computer and use it in GitHub Desktop.
Save amotoki/65f08c00393e814776a3e450ccdd197d to your computer and use it in GitHub Desktop.
Django 2.0 support
Replace django.core.urlresolves with django.urls
(In Django 2.0) The django.core.urlresolvers module is removed
in favor of its new location, django.urls.
It was deprecated in Django 1.10:
https://docs.djangoproject.com/en/2.0/releases/1.10/#id3
Add py35dj20 job to test Django 2.0 integration.
Also drops older Django unit tests from tox.ini
as horizon dropped Django <=1.10 support in Rocky.
----
grep 'from django.core.urlresolvers import' **/*.py
sed -i -e 's/from django.core.urlresolvers import/from django.urls import/' **/*.py
grep 'from django.core.urlresolvers import' **/*.py
grep 'from django.core import urlresolvers' **/*.py
sed -i -e 's/from django.core import urlresolvers/from django import urls/' **/*.py
sed -i -e 's/urlresolvers\./urls\./' **/*.py
grep urlresolvers **/*.py
----
[.zuul.yaml]
+ - horizon-openstack-tox-py35dj20:
+ required-projects:
+ openstack/horizon
----
[tox.ini]
+[testenv:py35dj20]
+basepython = python3.5
+commands =
+ pip install django>=2.0,<2.1
+ {[unit_tests]commands}
+
----
tox -e py35dj20 --notest -r
.tox/py35dj20/bin/pip install -e ../horizon
tox -e py35dj20
tox -e py35 --notest -r
.tox/py35dj20/bin/pip install -e ../horizon
tox -e py35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment