강의로 돌아가기
-

도와주세요.에러가 생기네요

PS C:\code\mysite> python manage.py makemigrations
Traceback (most recent call last):
File manage.py, line 10, in
execute_from_command_line(sys.argv)
File C:\Anaconda2\lib\site-packages\django\core\management\__init__.py, line 353, in execute_from_command_line
utility.execute()
File C:\Anaconda2\lib\site-packages\django\core\management\__init__.py, line 327, in execute
django.setup()
File C:\Anaconda2\lib\site-packages\django\__init__.py, line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File C:\Anaconda2\lib\site-packages\django\apps\registry.py, line 108, in populate
app_config.import_models(all_models)
File C:\Anaconda2\lib\site-packages\django\apps\config.py, line 202, in import_models
self.models_module = import_module(models_module_name)
File C:\Anaconda2\lib\importlib\__init__.py, line 37, in import_module
import(name)
File C:\code\mysite\elections\models.py, line 6, in
class Candidate(models.model):
AttributeError: 'module' object has no attribute 'model'

위처럼 에러가 생겨서, models.py페이지를 살펴보면

from django.db import models
class Candidate(models.model):
name = models.CharField(max_length=10)
introduction = models.TextField()
area = models.CharField(max_length=15)
party_number = models.IntegerField(default=0)

==> 'model'의 reference를 찾을수 없다고 나오네요 ㅠㅠ

1 개의 답변
-

class Candidate(models.model):에서 models.model이 아니라 models.Model 입니다

대문자로 써주세요

  • -
    ㅎㅎㅎ 감사합니다. 잘되네요 ㅠㅠ - 2017.08.18 11:24
답변 쓰기
이 입력폼은 마크다운 문법을 지원합니다. 마크다운 가이드 를 참고하세요.