Django:ImportError: cannot import name patterns

tags: django  url

Xiaobai record:
Django+admin+DjangoUeditor background management, when adding rich text plugin, error

ImportError: cannot import name patterns
File “C:\PycharmProject\Qiuzhiquan\DjangoUeditor\urls.py”, line 4, in
from django.conf.urls import patterns, url

Environment: python2.7 + django1.11 + DjangoUeditor1.8
At first I thought that I couldn't get the url in the project.

from django.conf.urls import url, include

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^ueditor/', include('DjangoUeditor.urls')),# Add editor mapping
]

Open DjangoUeditor.urls, check it, it turns out that django1.11 will report pattern errors. To remove the patterns in urls.py under the DjangoUeditor directory, change the url:

#coding:utf-8
from django import VERSION
if VERSION[0:2]>(1,3): from django.conf.urls import  url
else: from django.conf.urls.defaults import url

from views import get_ueditor_controller

urlpatterns = [
url(r'^controller/$',get_ueditor_controller)
]

Intelligent Recommendation

ImportError: cannot import name main

Modified, /usr/bin/pip file will import sys from pip import main if name == ‘main’: sys.exit(main()) Changed to: import sys from pip import main if name == ‘main’: sys.exit(mai...

ImportError: cannot import name 'NetworkXLabelGraphClusterer

The following problem occurred when running the multi-tag library today: Solution You also need to install the community package: Otherwise an error may occur: references [1].Cannot import 'NetworkXLa...

ImportError: cannot import name 'initializations'

In Keras 2.0, initializations was renamed (mirror) as initializers. You should therefore instead write...

ImportError: cannot import name 'imresize'

An error occurred: ImportError: cannot import name 'imresize' 1. Install the pile: 2. Install an earlier version: Scipy version issue, advanced version no longer contains functionsimresizeThe explanat...

ImportError: cannot import name _main_

We sometimes encounter this problem when using pip installation: Traceback (most recent call last):   File "/usr/bin/pip", line 9, in <module>     from pip import&n...

More Recommendation

ImportError: cannot import name UnrewindableBodyError

Error message: Solution, reloadingurllib3 Library:...

ImportError: cannot import name 'extension_dict'

This error occurs because protobuf3 in this function is disabled, so the solution is to uninstall protobuf3, installation protobuf2...

ImportError: cannot import name 'abs'

import tensorflow when there are mistakes: After google, I found the reason, found protobuf with tensorflow conflict. 1. delete tensorflow related modules 2. Delete protobuf related modules 3. Reinsta...

"ImportError: cannot import name OVSLegacyKernelSwitch"

My VirtualMachine OS is Ubuntu14.04, Linux. Recently I want to install the mininet in my OS, and I used the following steps to install it: then it successfully. However, when I tried the command mn to...

ImportError: cannot import name 'Sonnet'

ImportError: cannot import name 'Sonnet'   Solution: replace with     ->https://github.com/deepmind/sonnet/issues/112...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top