diff --git a/code/dpro/mask/views.py b/code/dpro/mask/views.py index 91ea44a..c8f1612 100644 --- a/code/dpro/mask/views.py +++ b/code/dpro/mask/views.py @@ -1,3 +1,10 @@ -from django.shortcuts import render +from django.shortcuts import render # django的模板渲染包 -# Create your views here. +# Initializing the imports +import numpy as np # 矩阵运算 +import urllib # url解析 +import json # json字符串使用 +import cv2 # opencv包 +import os # 执行操作系统命令 +from django.views.decorators.csrf import csrf_exempt # 跨站点验证 +from django.http import JsonResponse # json字符串返回 diff --git a/code/dpro/start/settings.py b/code/dpro/start/settings.py index ced430c..acdf80a 100644 --- a/code/dpro/start/settings.py +++ b/code/dpro/start/settings.py @@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ - +import os from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -37,6 +37,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'mask', ] MIDDLEWARE = [ @@ -54,7 +55,7 @@ ROOT_URLCONF = 'start.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [os.path.join(BASE_DIR,'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [