TypeError: аргумент типа 'PosixPath' не является итерируемым, старое решение не сработало
Я изучаю django и получаю эту ошибку, и даже когда я захожу в админку, CSS также не загружается. То, что я добавил в models.py, также не отображается в админке. Пожалуйста, кто-нибудь помогите мне избавиться от этой проблемы. Я пробовал искать в google и youtube.
Ошибка
`Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/subas/opt/anaconda3/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/subas/opt/anaconda3/lib/python3.8/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/subas/opt/anaconda3/lib/python3.8/site-packages/django/core/management/base.py", line 336, in run_from_argv
connections.close_all()
File "/Users/subas/opt/anaconda3/lib/python3.8/site-packages/django/db/utils.py", line 224, in close_all
connection.close()
File "/Users/subas/opt/anaconda3/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 248, in close
if not self.is_in_memory_db():
File "/Users/subas/opt/anaconda3/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 367, in is_in_memory_db
return self.creation.is_in_memory_db(self.settings_dict['NAME'])
File "/Users/subas/opt/anaconda3/lib/python3.8/site-packages/django/db/backends/sqlite3/creation.py", line 12, in is_in_memory_db
return database_name == ':memory:' or 'mode=memory' in database_name
TypeError: argument of type 'PosixPath' is not iterable`
Model.py
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=255, db_index=True)
slug = models.SlugField(max_length=255, unique=True)
class Meta:
verbose_name_plural = 'categories'
def get_absolute_url(self):
return reverse('store:category-list', args=[self.slug])
def __str__(self):
return self.name
class Product(models.Model):
category = models.ForeignKey(Category, related_name='product', on_delete=models.CASCADE)
created_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='Product_creator')
title = models.CharField(max_length= 255)
brand = models.CharField(max_length=255, default='Non-branded')
description = models.TextField(blank=True)
image = models.ImageField(upload_to='images/')
slug = models.SlugField(max_length = 255)
price = models.DecimalField(max_digits=6, decimal_places=2)
in_Stock = models.BooleanField(default = True)
is_active = models.BooleanField(default = True)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
class Meta:
verbose_name_pliral = 'Products'
ordering = ('-Created', )
def __str__(self):
return self.title ````