首先打开 Anconda 下的prompt
然后 命令行 pip3 install django-cors-headers
然后设置 settings.py 如下
# -*- coding:utf-8 -*-
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '=eo0xnb88w)jvt6n1-0t3p_k)mywxagpn2$l=2*3+kz1^wm4n_'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin'