Django模型类app.models.tasks不声明显式app_标签,也不在已安装的app_应用程序中的应用程序中
我的Django站点有这个视图和模型设置 当我运行我的页面,我得到下面的错误,我不知道为什么 如果有人能推荐我能做些什么来解决这个问题,我将非常感激 有人能帮忙吗Django模型类app.models.tasks不声明显式app_标签,也不在已安装的app_应用程序中的应用程序中,django,Django,我的Django站点有这个视图和模型设置 当我运行我的页面,我得到下面的错误,我不知道为什么 如果有人能推荐我能做些什么来解决这个问题,我将非常感激 有人能帮忙吗 'Model class app.models.tasks doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. 这是密码 from __future__ import unicode_literals from dj
'Model class app.models.tasks doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
这是密码
from __future__ import unicode_literals
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.contrib.auth import authenticate, login, logout
from django.contrib import messages
from django.http import *
from django.shortcuts import render_to_response,redirect
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserChangeForm
from django.db.models import Q
from django.db.models import Count
from datetime import datetime
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.forms import PasswordChangeForm
from datetime import date
from .models import tasks
def create_task(request):
if request.method == 'POST':
creator = request.user
job_title = request.POST.get('job_title')
skill_name = request.POST.get('skill_name')
starting = request.POST.get('starting')
description = request.POST.get('description')
target_date = request.POST.get('target_date')
i = tasks.objects.create(creator=creator, job_title=job_title, skill_name=skill_name, starting=starting, current=starting, description=description, target_date=target_date)
messages.success(request, ('Skill created'))
return redirect('index')
我有这个模型:
from django.db import models
class tasks(models.Model):
job_title = models.CharField(max_length=400, default="none")
creator = models.CharField(max_length=400, default="none")
skill_name = models.CharField(max_length=400)
starting = models.CharField(max_length=400, default="none")
current = models.CharField(max_length=400, default="none")
description = models.CharField(max_length=4000000, default="none")
target_date = models.CharField(max_length=400, default="none")
def __str__(self):
return self.text
根据上面的评论,当配置了一个新的应用程序,但不是设置中已安装的应用程序的一部分时,就会发生此错误。py您是否使用settings.py中的应用程序名称更新了已安装的应用程序?我真是愚蠢到令人难以置信。非常感谢。别担心!这发生在我们所有人身上: