Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django warnings about deprecated url patters for Django >=2.0 #128

Closed
belugame opened this issue Oct 12, 2018 · 2 comments
Closed

Django warnings about deprecated url patters for Django >=2.0 #128

belugame opened this issue Oct 12, 2018 · 2 comments

Comments

@belugame
Copy link
Collaborator

When running tests on Django 2.0+ we see these 2 warnings. Should be an easy fix.

py36-django20 create: /app/.tox/py36-django20
py36-django20 installdeps: Django>=2.0,<2.1, django-nose, markdown<3.0, djangorestframework, flake8, freezegun, mkdocs, pyOpenSSL, pytest-django, setuptools, twine, wheel
py36-django20 inst: /app/.tox/dist/django-rest-knox-3.3.1.zip
py36-django20 installed: asn1crypto==0.24.0,atomicwrites==1.2.1,attrs==18.2.0,bleach==3.0.2,certifi==2018.8.24,cffi==1.11.5,chardet==3.0.4,Click==7.0,cmarkgfm==0.4.2,cryptography==2.3.1,Django==2.0.9,django-nose==1.4.6,django-rest-knox==3.3.1,djangorestframework==3.8.2,docutils==0.14,flake8==3.5.0,freezegun==0.3.10,future==0.16.0,idna==2.7,Jinja2==2.10,livereload==2.5.2,Markdown==2.6.11,MarkupSafe==1.0,mccabe==0.6.1,mkdocs==1.0.4,more-itertools==4.3.0,nose==1.3.7,pkginfo==1.4.2,pluggy==0.7.1,py==1.6.0,pycodestyle==2.3.1,pycparser==2.19,pyflakes==1.6.0,Pygments==2.2.0,pyOpenSSL==18.0.0,pytest==3.8.2,pytest-django==3.4.3,python-dateutil==2.7.3,pytz==2018.5,PyYAML==3.13,readme-renderer==22.0,requests==2.19.1,requests-toolbelt==0.8.0,six==1.11.0,tornado==5.1.1,tqdm==4.26.0,twine==1.12.1,urllib3==1.23,webencodings==0.5.1
py36-django20 runtests: PYTHONHASHSEED='2083888879'
py36-django20 runtests: commands[0] | python manage.py migrate
System check identified some issues:

WARNINGS:
?: (2_0.W001) Your URL pattern '^api/$' [name='api-root'] has a route that contains '(?P<', begins with a '^', or ends with a '$'. This was likely an oversight when migrating to django.urls.path().
?: (2_0.W001) Your URL pattern '^api/' has a route that contains '(?P<', begins with a '^', or ends with a '$'. This was likely an oversight when migrating to django.urls.path().
@YashGulati
Copy link

YashGulati commented Oct 15, 2018

The workaround which I did.
Try to change the path string as below in knox/urls.py file.

urlpatterns = [
    path(r'api/', include('knox.urls')),
    path(r'api/', RootView.as_view(), name="api-root"),
]

But the issue is something else also, not able to even login after that.

johnraz added a commit to johnraz/django-rest-knox that referenced this issue Oct 23, 2018
`path` will trigger a warning when used with a regex while
`re_path` is what should be used instead.
@johnraz
Copy link
Collaborator

johnraz commented Oct 23, 2018

@belugame I think the above should be ok (at least tests passed locally) 😉

belugame added a commit that referenced this issue Oct 23, 2018
Fix #128 Replace path with re_path in test urls
dontexit pushed a commit to dontexit/django-rest-knox that referenced this issue Jan 24, 2024
`path` will trigger a warning when used with a regex while
`re_path` is what should be used instead.
dontexit pushed a commit to dontexit/django-rest-knox that referenced this issue Jan 24, 2024
…arnings

Fix jazzband#128 Replace path with re_path in test urls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants