Django1.11升级到Django2.2.14

1、django自带的认证系统

报错:

修改:

if user.is_authenticated:

 2、url include模块

报错:

1) url(r'^admin/', include(admin.site.urls))

'provide the namespace argument to include() instead.' % len(arg)
django.core.exceptions.ImproperlyConfigured: Passing a 3-tuple to include() is not supported. Pass a 2-tuple containing the list of patterns and app_name, and provide the namespace argument to include() instead.

2) url(r'^', include('applications.web.urls', app_name='web', namespace='web'))

TypeError: include() got an unexpected keyword argument 'app_name'

修改:

1) url(r'^admin/', admin.site.urls)

2) url(r'^', include(('applications.web.urls', 'web'), namespace='web'))

3、 middleware中间件

报错:

MIDDLEWARE_CLASS = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
   )

ERRORS:
?: (admin.E408) 'django.contrib.auth.middleware.AuthenticationMiddleware' must be in MIDDLEWARE in order to use the admin application.
?: (admin.E409) 'django.contrib.messages.middleware.MessageMiddleware' must be in MIDDLEWARE in order to use the admin application.
?: (admin.E410) 'django.contrib.sessions.middleware.SessionMiddleware' must be in MIDDLEWARE in order to use the admin application.

修改:

MIDDLEWARE = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
   )

4、其他需要兼容:

我的工程没涉及到,  本文只是提及一下

1) 数据库驱动PyMySQL兼容

2) 外键管理 on_delete

 

 

你可能感兴趣的:(python)