from django import http
from django.contrib.auth import login
from django.urls import reverse
from users.models import User
from django.http import HttpResponseForbidden
from django.shortcuts import render, redirect
import re
# Create your views here.
from django.views import View
from django.db import DatabaseError
from meiduo_mall.meiduo_mall.utils.response_code import RETCODE
class UsernameCountView(View):
def get(self, request, username):
count = User.objects.filter(username=username).count()
return http.JsonResponse({'code': 'RETCODE.OK', 'errmsg': 'OK', 'count': count})
应该是模块路径引用问题 当前路径下搜索不到这个路径 make dictionary as source root