Browse Source

[Django40_warning] RemovedInDjango40Warning: django.conf.urls.url() is deprecated in favor of django.urls.re_path()

ayush.goyal 4 years ago
parent
commit
6960bfeafc
36 changed files with 229 additions and 37 deletions
  1. 7 1
      apps/about/src/about/urls.py
  2. 7 1
      apps/beeswax/src/beeswax/urls.py
  3. 7 1
      apps/filebrowser/src/filebrowser/urls.py
  4. 7 1
      apps/hbase/src/hbase/urls.py
  5. 7 1
      apps/help/src/help/urls.py
  6. 6 1
      apps/hive/src/hive/urls.py
  7. 6 1
      apps/impala/src/impala/urls.py
  8. 6 1
      apps/jobbrowser/src/jobbrowser/urls.py
  9. 7 1
      apps/jobsub/src/jobsub/urls.py
  10. 7 1
      apps/metastore/src/metastore/urls.py
  11. 6 1
      apps/oozie/src/oozie/urls.py
  12. 7 1
      apps/pig/src/pig/urls.py
  13. 7 1
      apps/proxy/src/proxy/urls.py
  14. 7 1
      apps/rdbms/src/rdbms/urls.py
  15. 6 1
      apps/search/src/search/urls.py
  16. 7 1
      apps/security/src/security/urls.py
  17. 7 1
      apps/sqoop/src/sqoop/urls.py
  18. 5 1
      apps/useradmin/src/useradmin/urls.py
  19. 7 1
      apps/zookeeper/src/zookeeper/urls.py
  20. 7 1
      desktop/core/src/desktop/app_template/src/app_name/urls.py
  21. 7 1
      desktop/core/src/desktop/app_template_proxy/src/app_name/urls.py
  22. 6 1
      desktop/core/src/desktop/lib/analytics/urls.py
  23. 7 1
      desktop/core/src/desktop/lib/botserver/urls.py
  24. 6 1
      desktop/core/src/desktop/lib/connectors/urls.py
  25. 6 1
      desktop/core/src/desktop/lib/metrics/urls.py
  26. 6 1
      desktop/core/src/desktop/lib/scheduler/urls.py
  27. 2 1
      desktop/core/src/desktop/tests.py
  28. 6 1
      desktop/core/src/desktop/urls.py
  29. 7 1
      desktop/libs/dashboard/src/dashboard/urls.py
  30. 7 1
      desktop/libs/indexer/src/indexer/urls.py
  31. 7 1
      desktop/libs/kafka/src/kafka/urls.py
  32. 7 1
      desktop/libs/liboauth/src/liboauth/urls.py
  33. 5 1
      desktop/libs/libsaml/src/libsaml/urls.py
  34. 6 1
      desktop/libs/metadata/src/metadata/urls.py
  35. 6 2
      desktop/libs/notebook/src/notebook/routing.py
  36. 5 1
      desktop/libs/notebook/src/notebook/urls.py

+ 7 - 1
apps/about/src/about/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from about import views as about_views
 from about import views as about_views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', about_views.admin_wizard, name='index'),
   url(r'^$', about_views.admin_wizard, name='index'),
   url(r'^admin_wizard$', about_views.admin_wizard, name='admin_wizard'),
   url(r'^admin_wizard$', about_views.admin_wizard, name='admin_wizard'),

+ 7 - 1
apps/beeswax/src/beeswax/urls.py

@@ -15,12 +15,18 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from beeswax import views as beeswax_views
 from beeswax import views as beeswax_views
 from beeswax import create_database as beeswax_create_database
 from beeswax import create_database as beeswax_create_database
 from beeswax import create_table as beeswax_create_table
 from beeswax import create_table as beeswax_create_table
 from beeswax import api as beeswax_api
 from beeswax import api as beeswax_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', beeswax_views.index, name='index'),
   url(r'^$', beeswax_views.index, name='index'),
 
 

+ 7 - 1
apps/filebrowser/src/filebrowser/urls.py

@@ -15,10 +15,16 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from filebrowser import views as filebrowser_views
 from filebrowser import views as filebrowser_views
 from filebrowser import api as filebrowser_api
 from filebrowser import api as filebrowser_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   # Base view
   # Base view
   url(r'^$', filebrowser_views.index, name='index'),
   url(r'^$', filebrowser_views.index, name='index'),

+ 7 - 1
apps/hbase/src/hbase/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from hbase import views as hbase_views
 from hbase import views as hbase_views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', hbase_views.app, name='index'),
   url(r'^$', hbase_views.app, name='index'),
   url(r'api/(?P<url>.+)$', hbase_views.api_router),
   url(r'api/(?P<url>.+)$', hbase_views.api_router),

+ 7 - 1
apps/help/src/help/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from help import views as help_views
 from help import views as help_views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', help_views.view, { "app": "desktop", "path": "/index.html" }),
   url(r'^$', help_views.view, { "app": "desktop", "path": "/index.html" }),
   url(r'^(?P<app>\w*)(?P<path>/.*)$', help_views.view, name='help.views.view'),
   url(r'^(?P<app>\w*)(?P<path>/.*)$', help_views.view, name='help.views.view'),

+ 6 - 1
apps/hive/src/hive/urls.py

@@ -15,7 +15,12 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
 
 
 
 
 urlpatterns = [
 urlpatterns = [

+ 6 - 1
apps/impala/src/impala/urls.py

@@ -15,11 +15,16 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
 
 
 from beeswax.urls import urlpatterns as beeswax_urls
 from beeswax.urls import urlpatterns as beeswax_urls
 from impala import api as impala_api
 from impala import api as impala_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^api/invalidate$', impala_api.invalidate, name='invalidate'),
   url(r'^api/invalidate$', impala_api.invalidate, name='invalidate'),
   url(r'^api/refresh/(?P<database>\w+)/(?P<table>\w+)$', impala_api.refresh_table, name='refresh_table'),
   url(r'^api/refresh/(?P<database>\w+)/(?P<table>\w+)$', impala_api.refresh_table, name='refresh_table'),

+ 6 - 1
apps/jobbrowser/src/jobbrowser/urls.py

@@ -15,11 +15,16 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
 
 
 from jobbrowser import views as jobbrowser_views
 from jobbrowser import views as jobbrowser_views
 from jobbrowser import api2 as jobbrowser_api2
 from jobbrowser import api2 as jobbrowser_api2
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   # "Default"
   # "Default"
   url(r'^$', jobbrowser_views.jobs),
   url(r'^$', jobbrowser_views.jobs),

+ 7 - 1
apps/jobsub/src/jobsub/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from jobsub import views as jobsub_views
 from jobsub import views as jobsub_views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   # The base view is the "list" view, which we alias as /
   # The base view is the "list" view, which we alias as /
   url(r'^$', jobsub_views.list_designs),
   url(r'^$', jobsub_views.list_designs),

+ 7 - 1
apps/metastore/src/metastore/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from metastore import views as metastore_views
 from metastore import views as metastore_views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', metastore_views.index, name='index'),
   url(r'^$', metastore_views.index, name='index'),
 
 

+ 6 - 1
apps/oozie/src/oozie/urls.py

@@ -15,12 +15,17 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from oozie.views import editor as oozie_views_editor
 from oozie.views import editor as oozie_views_editor
 from oozie.views import editor2 as oozie_views_editor2
 from oozie.views import editor2 as oozie_views_editor2
 from oozie.views import api as oozie_views_api
 from oozie.views import api as oozie_views_api
 from oozie.views import dashboard as oozie_views_dashboard
 from oozie.views import dashboard as oozie_views_dashboard
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
 
 
 IS_URL_NAMESPACED = True
 IS_URL_NAMESPACED = True
 
 

+ 7 - 1
apps/pig/src/pig/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from pig import views as pig_views
 from pig import views as pig_views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', pig_views.app, name='index'),
   url(r'^$', pig_views.app, name='index'),
 
 

+ 7 - 1
apps/proxy/src/proxy/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from proxy import views as proxy_views
 from proxy import views as proxy_views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   # Prefix the names of your views with the app name.
   # Prefix the names of your views with the app name.
   url(r'^(?P<host>[^/]+)/(?P<port>\d+)(?P<path>/.*)$', proxy_views.proxy, name="proxy.views.proxy"),
   url(r'^(?P<host>[^/]+)/(?P<port>\d+)(?P<path>/.*)$', proxy_views.proxy, name="proxy.views.proxy"),

+ 7 - 1
apps/rdbms/src/rdbms/urls.py

@@ -15,12 +15,18 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from rdbms import views as rdbms_views
 from rdbms import views as rdbms_views
 from rdbms import api as rdbms_api
 from rdbms import api as rdbms_api
 from beeswax import views as beeswax_views
 from beeswax import views as beeswax_views
 from beeswax import api as beeswax_api
 from beeswax import api as beeswax_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 # Views
 # Views
 urlpatterns = [
 urlpatterns = [
   url(r'^$', rdbms_views.index, name='index'),
   url(r'^$', rdbms_views.index, name='index'),

+ 6 - 1
apps/search/src/search/urls.py

@@ -15,11 +15,16 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from search import views as search_views
 from search import views as search_views
 from dashboard import views as dashboard_views
 from dashboard import views as dashboard_views
 from dashboard import api as dashboard_api
 from dashboard import api as dashboard_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
 
 
 urlpatterns = [
 urlpatterns = [
   url(r'^install_examples$', search_views.install_examples, name='install_examples'),
   url(r'^install_examples$', search_views.install_examples, name='install_examples'),

+ 7 - 1
apps/security/src/security/urls.py

@@ -15,12 +15,18 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from security import views as security_views
 from security import views as security_views
 from security.api import hdfs as security_api_hdfs
 from security.api import hdfs as security_api_hdfs
 from security.api import hive as security_api_hive
 from security.api import hive as security_api_hive
 from security.api import sentry as security_api_sentry 
 from security.api import sentry as security_api_sentry 
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', security_views.hive, name='index'),
   url(r'^$', security_views.hive, name='index'),
   url(r'^hive$', security_views.hive, name='hive'),
   url(r'^hive$', security_views.hive, name='hive'),

+ 7 - 1
apps/sqoop/src/sqoop/urls.py

@@ -15,10 +15,16 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from sqoop import views as sqoop_views
 from sqoop import views as sqoop_views
 from sqoop import api as sqoop_api
 from sqoop import api as sqoop_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', sqoop_views.app, name='index')
   url(r'^$', sqoop_views.app, name='index')
 ]
 ]

+ 5 - 1
apps/useradmin/src/useradmin/urls.py

@@ -15,13 +15,17 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
 
 
 from desktop.lib.django_util import get_username_re_rule, get_groupname_re_rule
 from desktop.lib.django_util import get_username_re_rule, get_groupname_re_rule
 
 
 from useradmin import views as useradmin_views
 from useradmin import views as useradmin_views
 from useradmin import api as useradmin_api
 from useradmin import api as useradmin_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
 
 
 username_re = get_username_re_rule()
 username_re = get_username_re_rule()
 groupname_re = get_groupname_re_rule()
 groupname_re = get_groupname_re_rule()

+ 7 - 1
apps/zookeeper/src/zookeeper/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from zookeeper import views as zookeeper_views
 from zookeeper import views as zookeeper_views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', zookeeper_views.index, name='index'),
   url(r'^$', zookeeper_views.index, name='index'),
   url(r'view/(?P<id>\w+)$', zookeeper_views.view, name='view'),
   url(r'view/(?P<id>\w+)$', zookeeper_views.view, name='view'),

+ 7 - 1
desktop/core/src/desktop/app_template/src/app_name/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from ${app_name} import views
 from ${app_name} import views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', views.index),
   url(r'^$', views.index),
 ]
 ]

+ 7 - 1
desktop/core/src/desktop/app_template_proxy/src/app_name/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 import ${app_name}
 import ${app_name}
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', ${app_name}.views.index),
   url(r'^$', ${app_name}.views.index),
 ]
 ]

+ 6 - 1
desktop/core/src/desktop/lib/analytics/urls.py

@@ -15,10 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
 
 
 from desktop.lib.analytics import views, api
 from desktop.lib.analytics import views, api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 
 
 urlpatterns = [
 urlpatterns = [
   url(r'^$', views.index, name='desktop.lib.analytics.views.index'),
   url(r'^$', views.index, name='desktop.lib.analytics.views.index'),

+ 7 - 1
desktop/core/src/desktop/lib/botserver/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from desktop.lib.botserver import views
 from desktop.lib.botserver import views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^events/', views.slack_events, name='slack_events')
   url(r'^events/', views.slack_events, name='slack_events')
 ]
 ]

+ 6 - 1
desktop/core/src/desktop/lib/connectors/urls.py

@@ -15,10 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
 
 
 from desktop.lib.connectors import views, api
 from desktop.lib.connectors import views, api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 
 
 urlpatterns = [
 urlpatterns = [
   url(r'^$', views.index, name='desktop.lib.connectors.views.index'),
   url(r'^$', views.index, name='desktop.lib.connectors.views.index'),

+ 6 - 1
desktop/core/src/desktop/lib/metrics/urls.py

@@ -15,10 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
 
 
 from desktop.lib.metrics import views
 from desktop.lib.metrics import views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', views.index, name='desktop.lib.metrics.views.index'),
   url(r'^$', views.index, name='desktop.lib.metrics.views.index'),
 ]
 ]

+ 6 - 1
desktop/core/src/desktop/lib/scheduler/urls.py

@@ -15,10 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
 
 
 from desktop.lib.scheduler import api
 from desktop.lib.scheduler import api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 
 
 urlpatterns = [
 urlpatterns = [
   url(r'^api/schedule/new/?$', api.get_schedule, name='scheduler.api.new_schedule'),
   url(r'^api/schedule/new/?$', api.get_schedule, name='scheduler.api.new_schedule'),

+ 2 - 1
desktop/core/src/desktop/tests.py

@@ -35,7 +35,6 @@ from configobj import ConfigObj
 from django.db.models import query, CharField, SmallIntegerField
 from django.db.models import query, CharField, SmallIntegerField
 from django.core.management import call_command
 from django.core.management import call_command
 from django.core.paginator import Paginator
 from django.core.paginator import Paginator
-from django.conf.urls import url
 from django.db import connection
 from django.db import connection
 from django.urls import reverse
 from django.urls import reverse
 from django.test.client import Client
 from django.test.client import Client
@@ -74,9 +73,11 @@ from desktop.views import check_config, home, generate_configspec, load_confs, c
 if sys.version_info[0] > 2:
 if sys.version_info[0] > 2:
   from io import StringIO as string_io
   from io import StringIO as string_io
   from unittest.mock import patch, Mock
   from unittest.mock import patch, Mock
+  from django.urls import re_path as url
 else:
 else:
   from cStringIO import StringIO as string_io
   from cStringIO import StringIO as string_io
   from mock import patch, Mock
   from mock import patch, Mock
+  from django.conf.urls import url
 
 
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)

+ 6 - 1
desktop/core/src/desktop/urls.py

@@ -19,6 +19,7 @@ from __future__ import absolute_import
 
 
 import logging
 import logging
 import re
 import re
+import sys
 
 
 
 
 # FIXME: This could be replaced with hooking into the `AppConfig.ready()`
 # FIXME: This could be replaced with hooking into the `AppConfig.ready()`
@@ -33,7 +34,6 @@ import desktop.lib.metrics.file_reporter
 desktop.lib.metrics.file_reporter.start_file_reporter()
 desktop.lib.metrics.file_reporter.start_file_reporter()
 
 
 from django.conf import settings
 from django.conf import settings
-from django.conf.urls import include, url
 from django.views.static import serve
 from django.views.static import serve
 
 
 from notebook import views as notebook_views
 from notebook import views as notebook_views
@@ -50,6 +50,11 @@ from desktop.configuration import api as desktop_configuration_api
 from desktop.lib.vcs import api as desktop_lib_vcs_api
 from desktop.lib.vcs import api as desktop_lib_vcs_api
 from desktop.settings import is_oidc_configured
 from desktop.settings import is_oidc_configured
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import include, url
+else:
+  from django.urls import include, re_path as url
+
 # Django expects handler404 and handler500 to be defined.
 # Django expects handler404 and handler500 to be defined.
 # django.conf.urls provides them. But we want to override them.
 # django.conf.urls provides them. But we want to override them.
 # Also see http://code.djangoproject.com/ticket/5350
 # Also see http://code.djangoproject.com/ticket/5350

+ 7 - 1
desktop/libs/dashboard/src/dashboard/urls.py

@@ -15,10 +15,16 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from dashboard import views as dashboard_views
 from dashboard import views as dashboard_views
 from dashboard import api as dashboard_api
 from dashboard import api as dashboard_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^$', dashboard_views.index, name='index'),
   url(r'^$', dashboard_views.index, name='index'),
   url(r'^m$', dashboard_views.index_m, name='index_m'),
   url(r'^m$', dashboard_views.index_m, name='index_m'),

+ 7 - 1
desktop/libs/indexer/src/indexer/urls.py

@@ -15,7 +15,8 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from indexer import views as indexer_views
 from indexer import views as indexer_views
 from indexer import solr_api as indexer_solr_api
 from indexer import solr_api as indexer_solr_api
 from indexer import api3 as indexer_api3
 from indexer import api3 as indexer_api3
@@ -24,6 +25,11 @@ from indexer import api as indexer_api
 
 
 from indexer.conf import ENABLE_NEW_INDEXER
 from indexer.conf import ENABLE_NEW_INDEXER
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^install_examples$', indexer_views.install_examples, name='install_examples'),
   url(r'^install_examples$', indexer_views.install_examples, name='install_examples'),
 
 

+ 7 - 1
desktop/libs/kafka/src/kafka/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from kafka import kafka_api as kafka_kafka_api
 from kafka import kafka_api as kafka_kafka_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
   url(r'^api/topics/list/$', kafka_kafka_api.list_topics, name='list_topics'),
   url(r'^api/topics/list/$', kafka_kafka_api.list_topics, name='list_topics'),
   url(r'^api/topic/list/$', kafka_kafka_api.list_topic, name='list_topic'),
   url(r'^api/topic/list/$', kafka_kafka_api.list_topic, name='list_topic'),

+ 7 - 1
desktop/libs/liboauth/src/liboauth/urls.py

@@ -15,9 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
+
 from liboauth import views as liboauth_views
 from liboauth import views as liboauth_views
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 urlpatterns = [
 urlpatterns = [
        url(r'^accounts/login/$', liboauth_views.show_login_page, name='show_oauth_login'),
        url(r'^accounts/login/$', liboauth_views.show_login_page, name='show_oauth_login'),
        url(r'^social_login/oauth/?$', liboauth_views.oauth_login, name='oauth_login'),
        url(r'^social_login/oauth/?$', liboauth_views.oauth_login, name='oauth_login'),

+ 5 - 1
desktop/libs/libsaml/src/libsaml/urls.py

@@ -16,8 +16,12 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
+import sys
 
 
-from django.conf.urls import url
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
 
 
 LOG = logging.getLogger(__name__)
 LOG = logging.getLogger(__name__)
 
 

+ 6 - 1
desktop/libs/metadata/src/metadata/urls.py

@@ -15,13 +15,18 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
 
 
 from metadata import catalog_api as metadata_catalog_api, analytic_db_api, dataeng_api, prometheus_api
 from metadata import catalog_api as metadata_catalog_api, analytic_db_api, dataeng_api, prometheus_api
 from metadata import optimizer_api as metadata_optimizer_api
 from metadata import optimizer_api as metadata_optimizer_api
 from metadata import workload_analytics_api as metadata_workload_analytics_api
 from metadata import workload_analytics_api as metadata_workload_analytics_api
 from metadata import manager_api as metadata_manager_api
 from metadata import manager_api as metadata_manager_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 
 
 # Catalog
 # Catalog
 urlpatterns = [
 urlpatterns = [

+ 6 - 2
desktop/libs/notebook/src/notebook/routing.py

@@ -15,11 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-# from django.urls import re_path # Django 2
-from django.conf.urls import url
+import sys
 
 
 from desktop.conf import has_channels
 from desktop.conf import has_channels
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
+
 
 
 if has_channels():
 if has_channels():
   from notebook import consumer
   from notebook import consumer

+ 5 - 1
desktop/libs/notebook/src/notebook/urls.py

@@ -15,11 +15,15 @@
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
 
 
-from django.conf.urls import url
+import sys
 
 
 from notebook import views as notebook_views
 from notebook import views as notebook_views
 from notebook import api as notebook_api
 from notebook import api as notebook_api
 
 
+if sys.version_info[0] < 3:
+  from django.conf.urls import url
+else:
+  from django.urls import re_path as url
 
 
 # Views
 # Views
 urlpatterns = [
 urlpatterns = [