解决方法
-
settings.py
中配置ALLOWED_HOSTS
,结果如下:ALLOWED_HOSTS = ['*']
-
settings.py
中配置MIDDLEWARE
,注释XFrameOptionsMiddleware
,结果如下:MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', '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', # 注释这一条 ]