Deployment on embedded devices has been fine, but this problem occurs on Linux Centos7, usually due to versioning issues.
Solution Install pip3 install Django==1.11.1
However, the following ImportError: cannot import name patterns
vim touch/extra_apps/DjangoUeditor/urls.py
# coding:utf-8
from django import VERSION
if VERSION[0:2] > (1, 3):
from django.conf.urls import patterns, url
else:
from django.conf.urls.defaults import patterns, url
from .views import get_ueditor_controller
urlpatterns = [
url(r’^controller/$’, get_ueditor_controller)
]
to:
# 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)
]
Due to version issues, this may cause the following problems
render_to_string() got an unexpected keyword argument ‘context_instance’
Solution:
context must be a dict rather than RequestContext.
is when the context becomes
{
“context”:context
}
Due to the version upgrade, the previous code
return render_to_response(‘info_count.html’, {}, context_instance=RequestContext(request))
should be rewritten to something like this.
from django.shortcuts import render
return render(request, “info_main.html”, {‘time_refresh’: time_refresh,
‘time_refresh_long’: time_refresh_long,
‘time_refresh_net’: time_refresh_net,
‘version’: version})
Similar Posts:
- ImportError: cannot import name ‘patterns’
- [Django CSRF tutorial] solve the problem of forbidden (403) CSRF verification failed. Request aborted
- How to Solve Django xadmin installation Error [7 Types of Errors]
- Django @csrf_exempt Cannot work in class view (Django @csrf_exempt not working in class View)
- “No module named context_processors”
- Django exception-ImportError: No module named django.core.management
- Uncaught Error: _registerComponent(…): Target container is not a DOM element
- Odoo14 TypeError: Cannot read property ‘classList’ of undefined
- ERRORS: ?: (corsheaders.E013) Origin ‘*’ in CORS_ORIGIN_WHITELIST is missing scheme or ne…
- Solutions to xadmin’s “apps are’t loaded yet” error