В настройках ничего не менял. Просто написал класс модели и попытался выполнить:
py manage.py makemigrations
import PIL
from django.db import models
available = (('is', "В наличии"), ('c', "Под заказ"))
class Phone(models.Model):
name = models.CharField(max_length=100, verbose_name='Название', help_text='Введите название', default='')
availability = models.CharField(max_length=100, verbose_name='Наличие', choices=available, default=available[0])
photo = models.ImageField(name='1', upload_to='/{0}/'.format(name))
D:\Projects\elektroswit>py manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Alex\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_command_line
utility.execute()
File "C:\Users\Alex\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\management\__init__.py", line 327, in execute
django.setup()
File "C:\Users\Alex\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Alex\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\apps\registry.py", line 108, in populate
app_config.import_models(all_models)
File "C:\Users\Alex\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\apps\config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Alex\AppData\Local\Programs\Python\Python35-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 662, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "D:\Projects\elektroswit\shop\models.py", line 3, in <module>
class Phone(models.Model):
File "D:\Projects\elektroswit\shop\models.py", line 6, in Phone
photo = models.ImageField(name='1', upload_to='/{0}/'.format(name))
File "C:\Users\Alex\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\db\models\fields\__init__.py", line 188, in __str__
model = self.model
AttributeError: 'CharField' object has no attribute 'model'