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', ]
error:
Command using:python manage.py makemigrations Ganaana
Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\core\management__init__.py", line 364, in execut
e_from_command_line
utility.execute()
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\core\management__init__.py", line 338, in execute
django.setup()
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5
py3.6.egg\django\apps\registry.py", line 108, in populate
app_config.import_models()
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\apps\config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "C:\Program Files\Python36\lib\importlib__init__.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 "E:\PythonDjango\website\Ganaana\models.py", line 4, in
class Albums(models.Model):
File "E:\PythonDjango\website\Ganaana\models.py", line 5, in Albums
artist = models.CharField(self,max_lenght = 250)
NameError: name 'self' is not defined
PS E:\PythonDjango\website> python manage.py makemigration Ganaana
Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\core\management__init__.py", line 364, in execut
e_from_command_line
utility.execute()
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\core\management__init__.py", line 338, in execute
django.setup()
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\apps\registry.py", line 108, in populate
app_config.import_models()
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\apps\config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "C:\Program Files\Python36\lib\importlib__init__.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
PS E:\PythonDjango\website> python manage.py makemigration Ganaana
Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\core\management__init__.py", line 364, in execut
e_from_command_line
utility.execute()
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\core\management__init__.py", line 338, in execute
django.setup()
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\apps\registry.py", line 108, in populate
app_config.import_models()
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\apps\config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "C:\Program Files\Python36\lib\importlib__init__.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 "E:\PythonDjango\website\Ganaana\models.py", line 4, in
class Albums(models.Model):
File "E:\PythonDjango\website\Ganaana\models.py", line 5, in Albums
artist = models.CharField(max_lenght=250)
File "C:\Program Files\Python36\lib\site-packages\django-1.11.5-
py3.6.egg\django\db\models\fields__init__.py", line 1061, in init
super(CharField, self).init(*args, **kwargs)
TypeError: init() got an unexpected keyword argument 'max_lenght'
I dont understand my error? I have given a right name still getting error? can anybody identify the error
max_lenght
– user2233706