강의로 돌아가기
신 새벽

오류가 나오네요 도와주세요

D:\Work\PG Works\mysite>python manage.py makemigrations
Traceback (most recent call last):
File manage.py, line 22, in
execute_from_command_line(sys.argv)
File C:\Users\SB\AppData\Local\Programs\Python\Python36-32\lib\site-packages\
django\core\management\__init__.py
, line 367, in execute_from_command_line
utility.execute()
File C:\Users\SB\AppData\Local\Programs\Python\Python36-32\lib\site-packages\
django\core\management\__init__.py
, line 341, in execute
django.setup()
File C:\Users\SB\AppData\Local\Programs\Python\Python36-32\lib\site-packages\
django\__init__.py
, line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File C:\Users\SB\AppData\Local\Programs\Python\Python36-32\lib\site-packages\
django\apps\registry.py
, line 108, in populate
app_config.import_models(all_models)
File C:\Users\SB\AppData\Local\Programs\Python\Python36-32\lib\site-packages\
django\apps\config.py
, line 199, in import_models
self.models_module = import_module(models_module_name)
File C:\Users\SB\AppData\Local\Programs\Python\Python36-32\lib\importlib\__in
it__.py
, line 126, in import_module
return bootstrap._gcd_import(name[level:], package, level)
File , line 978, in _gcd_import
File , line 961, in _find_and_load
File , line 950, in _find_and_load_unlocked
File , line 655, in _load_unlocked
File , line 678, in exec_module
File , line 205, in _call_with_frames_removed
File D:\Work\PG Works\mysite\elections\models.py, line 4, in
class Candidate(models.Model):
File D:\Work\PG Works\mysite\elections\models.py, line 5, in Candidate
name = models.CharField(max_lenth=10)
File "C:\Users\SB\AppData\Local\Programs\Python\Python36-32\lib\site-packages\
django\db\models\fields__init
.py", line 1043, in __init_
super(CharField, self).init(*args, **kwargs)
TypeError: init() got an unexpected keyword argument 'max_lenth'

1 개의 답변
닉과르

\elections\models.py 파일에서 오타가 난듯 하네요..

name = models.CharField(max_lenth=10)

max_lenth ===> max_length 로 바꾸고 해보세요.

답변 쓰기
이 입력폼은 마크다운 문법을 지원합니다. 마크다운 가이드 를 참고하세요.