2017-09-19 6 views
1

Model.pyは、モデルではジャンゴで

from django.db import models 
class Albums(models.Model): 
    artist = models.CharField(max_lenght=250) 
    Albums_Name = models.CharField(max_lenght = 500) 
    Album_logo = models.CharField(max_lenght = 250) 
class Songs(models.Model): 
    albums=models.ForeignKey(Albums,on_delete=models.CASCADE) 
    file_type = models.CharField(max_lenght = 500) 
    Song_title = models.CharField(max_lenght = 500) 

setting.py

INSTALLED_APPS = [ 
    'Ganaana.apps.GanaanaConfig', 
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', ] 

エラーエラーを既知のはじめのpython manage.py makemigrations Ganaana トレースバック(最新の呼び出しの最後に) : ファイル "manage.py" 22行目 execute_from_command_line(sys.argv) ファイル "C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11.5-
ファイル "C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11。e_from_command_line utility.execute() ファイル" C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11。 "django.setup() ファイル" C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11 "を実行してください。 "apps.populate(settings.INSTALLED_APPS) ファイル" C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11.5 py3.6.egg \ django \ apps \ registry.py "、行108、読み込み中 app_config.import_models() ファイル" C:\ Program Files \ P import_modelsののself_models_module = import_module(models_module_name) のファイル "C:\ ython36 \ lib \ site-packages \ django-1.11.5- py3.6.egg \ django \ apps \ config.py" (ファイル名 "レベル:"、パッケージ、レベル) ファイル ""、行978、_gcd_import内 ファイル ""、行 "プログラムファイル\ Python36 \ lib \ importlib__init __。py"、行126、 import_module return _bootstrap._gcd_import _call_with_frames_removed ファイル「Eの "exec_module ファイルでは、ライン678、" _find_and_load ファイル "961、"、ライン950、_find_and_load_unlocked ファイルで ""、行655、_load_unlocked ファイルで ""、行205、:\ PythonDjango \ website \ Ganaana \ models.py "、行4、クラスAlbums(models.Model): ファイル "E:\ PythonDjango \ website \ Ganaana \ models.py"、行5、アルバム artist = models.CharField(self、max_lenght = 250) NameError:name 'self 「 ファイル "manage.py"、22行目、(sys.argvの) ファイル execute_from_command_lineで:\ PythonDjango \ウェブサイト>のpython manage.pyのmakemigration Ganaana トレースバック(最新の呼び出しの最後):「 PS E定義されていません。 C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11.5-
py3.6.egg \ django \ core \ management_init __。py "、行364、実行中 e_from_command_line ユーティリティー.execute() ファイル "C:\ Program Files \ Pyt hon36 \ libに\のsite-packages \ジャンゴ-1.11.5- py3.6.egg \ジャンゴ\コア\のmanagement__init __ PY C "で、ライン338、 django.setup() ファイルを実行":\プログラムファイルを\ Python36 \ lib \ site-packages \ django-1.11.5- py3.6.egg \ django__init __。py "、行27、セットアップ中 apps.populate(settings.INSTALLED_APPS) ファイル" C:\ Program Files \ Python36 \\ lib \ site-packages \ django-1.11.5- py3.6.egg \ django \ apps \ registry.py "行108、 \ lib \ site-packages \ django-1.11.5- py3.6.egg \ django \ apps \ config.py "、行202、import_models 自己。models_module = import_module(models_module_name) ファイル "C:\プログラムファイル\ Python36 \ libに\ importlib__init __ PY。" import_module リターン_bootstrap._gcd_importで、ライン126、(名前[レベル:]、パッケージ、レベル) ファイル "" 、_find_and_load_unlocked PS Eで_gcd_import ファイル "の行978、"、_find_and_load ファイルの行961、 ""、行950、:\ PythonDjango \ウェブサイト>のpython manage.py makemigration Ganaana トレースバック(最新の呼び出しの最後): ファイル "manage.py"、行22、 execute_from_command_line(sys.argv) ファイル "C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11.5- py3.6.egg \ django \ core \ management_init __。py "、行364、ステートメ e_from_command_line utility.execute() ファイル "C:\プログラムファイル\ Python36 \ libには\サイト - パッケージ\ジャンゴ-1.11.5-
py3.6.egg \ジャンゴ\コア\のmanagement__init __ PY。"、ライン338、実行中 django.setup() ファイル "C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11.5- py3.6.egg \ django__init __。py"、27行目、セットアップ中 apps.populate(settings.INSTALLED_APPS) ファイル "C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11.5- py3.6.egg \ django \ apps \ registry.py"、行108 、in populate app_config.import_models() ファイル "C:¥Program Files¥Python36¥lib¥site-packages¥django-1.11.5-"ファイル:C:¥Program Files¥Python36¥lib¥importlib__init __。py"、行126(ファイル名は、「ファイル名」、「ファイル名」、「ファイル名」、「ファイル名」、「ファイル名」、「ファイル名」、「ファイル名」、「ファイル名」、「ファイル名」、「ファイル名」、 _find_and_load_unlockedにおける "_gcd_import ファイルに、ライン978、"(、パッケージ、レベル名[レベル]) ファイル ""、ライン961、_find_and_load ファイルの ""、ライン950、 import_moduleに戻り_bootstrap._gcd_import ファイル ""、行655、_load_unlocked内 exec_module内のファイル ""、行678 ファイル ""、行205、_call_with_frames_removed内 ファイル "E:\ PythonDjango \ website \ Ganaana \ models.py"、4行目、 in クラスAlbums(models.Model): ファイル "C:¥Program Files¥Python36¥lib¥site-packages¥ ファイル" E:¥PythonDjango¥website¥Ganaana¥models.py "、行5、 artist = models.CharField(max_lenght = 250) ファイル: django-1.11.5- py3.6.egg \ django \ db \ models \ fields__init __。py "、行1061、init super(CharField、self) init(* args、** kwargs) TypeError:()は予期しないキーワード引数 'max_lenght'を持っています 私のエラーを理解していませんか?私はまだ正しい名前を与えてエラーが発生していますか?誰でもエラーを特定できます

+2

'' 'max_lenght'''の' 'max_length'''のスペルミスがあります。 – user2233706

答えて

2

これはmax_lengthで、max_lenghtではありません。マイナーな誤植 - あなたのモデルでそれを変更して問題が解決するかどうか確認してください:)

関連する問題