Questions

ImportError: cannot import name patterns

0

When I am trying to run my django project in virtualenv it is giving this error.

File "/Users/aakash/venv/lib/python2.7/site-packages/django_markdown/urls.py", line 3, in <module>
from django.conf.urls import patterns, url
ImportError: cannot import name patterns



asked 1 year, 10 months ago
Reputation: 1





1 Answer

0

Error is coming because patterns is depreciated form latest versions of django.

Open the file in which error is cominhg using editor.

nano /Users/aakash/venv/lib/python2.7/site-packages/django_markdown/urls.py

you will get this in your terminal/editor

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

urlpatterns = patterns(
    '', url('home/$', preview, name='home')
)

modify above by removing patterns from import and urlpatterns like this

from django.conf.urls import url
from .import views

urlpatterns = [
    url('home/$', view.index, name='home')
]

answered 1 year, 10 months ago
Reputation: 1





Your Answer

Nothing to preview

Post Answer



Asked:  1 year, 10 months ago
Viewed:  2671 times
Active:  1 year, 10 months ago