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

get NameError: name 'patterns' is not defined when following install instructions on centos7 #13

Closed
chicks-net opened this issue Jul 28, 2016 · 6 comments
Labels

Comments

@chicks-net
Copy link

While following https://github.com/sii/siptrackweb/wiki/Install-personal-dev-environment I ran into NameError: name 'patterns' is not defined when running python manage.py migrate. According to stackoverflow this can be fixed by replacing

from django.conf.urls import url, include

with

from django.conf.urls import url, include, patterns

which got me past that issue, but then I see

/var/venv/siptrack/lib/python2.7/site-packages/siptrackweb/urls.py:253: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
  (r'^prototype.js$', 'root.prototypejs'),

Should the instructions be updated to avoid this deprecation?

@chicks-net
Copy link
Author

Tivix/django-rest-auth#136 shows how another team handled this.

@stemid
Copy link
Collaborator

stemid commented Jul 28, 2016

Thanks, seems to me the main problem was in urls.py that django-admin generates. I've updated the docs to reflect its new appeareance.

Also might add some note in the docs about which Django version is recommended for that guide.

@chicks-net
Copy link
Author

I updated my stweb/urls.py to follow the docs and the warning is still there.

/var/venv/siptrack/lib/python2.7/site-packages/siptrackweb/urls.py:253: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.
  (r'^prototype.js$', 'root.prototypejs'),

I also see many lines of

/var/venv/siptrack/lib/python2.7/site-packages/django/conf/urls/__init__.py:89: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got view.add_post). Pass the callable instead.
  t = url(prefix=prefix, *t)

I'm guessing both of these are due to what is in siptrackweb/urls.py which still uses patterns().

@stemid
Copy link
Collaborator

stemid commented Jul 28, 2016

Will definitely move away from patterns() and towards using a urlpatterns list in the master branch too Chris, thanks for pointing that out. I'll make a PR asap.

All I did for now, and which was enough to get siptrack working on my CentOS 7 install, was to update the docs.

@chicks-net
Copy link
Author

Agreed. I was able to proceed with testing with it as-is.

Thanks for responding so quickly. 👍

@stemid
Copy link
Collaborator

stemid commented Oct 26, 2016

@sii this is most likely solved now considering you've upgraded urls.py to be more modern using list(urlpatterns) instead of patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants