سلام
من وقتی توی ترمینال کامند python manage.py migrate رو میزنم ارور زیر رو میده
solnnriw1h
rxmkr1382xgwobjfbpujn8cs103owsu1gusbrye1ba291fsry2
Operations to perform:
Apply all migrations: admin, auth, contenttypes, eshop_FAQ, eshop_contact, eshop_news, eshop_order, eshop_payment, eshop_products_category, eshop_setti
ngs, eshop_sliders, eshop_tag, products, sessions
Running migrations:
Applying eshop_payment.0006_auto_20210728_1158...Traceback (most recent call last):
File "D:\ali_eshop\manage.py", line 22, in <module>
main()
File "D:\ali_eshop\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\base.py", line 398, in execute
output = self.handle(*args, **options)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\commands\migrate.py", line 244, in handle
post_migrate_state = executor.migrate(
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\migration.py", line 126, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\operations\fields.py", line 244, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\schema.py", line 140, in alter_field
super().alter_field(model, old_field, new_field, strict=strict)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\base\schema.py", line 594, in alter_field
self._alter_field(model, old_field, new_field, old_type, new_type,
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\schema.py", line 362, in _alter_field
self._remake_table(model, alter_field=(old_field, new_field))
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\schema.py", line 202, in _remake_table
'default': self.quote_value(self.effective_default(new_field))
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\base\schema.py", line 310, in effective_default
return field.get_db_prep_save(self._effective_default(field), self.connection)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\models\fields\__init__.py", line 842, in get_db_prep_save
return self.get_db_prep_value(value, connection=connection, prepared=False)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\models\fields\__init__.py", line 837, in get_db_prep_value
value = self.get_prep_value(value)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\models\fields\__init__.py", line 986, in get_prep_value
return self.to_python(value)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\models\fields\__init__.py", line 976, in to_python
raise exceptions.ValidationError(
django.core.exceptions.ValidationError: ['مقدار «ggiui» باید True یا False باشد.']
(داداش کوچیکم یه بار کد هامو بهم ریخت شاید از اون باشه)
باید چیکار کنم که این ارور رو نده
سلام دوست من
در این خط مشکل رو گفته:
line 976, in to_python
raise exceptions.ValidationError(
django.core.exceptions.ValidationError: ['مقدار «ggiui» باید True یا False باشد.']
سلام
منون از پاسخ تون
الان تو کد های خودم باید چیکار کنم که این ارور رو نده چون این ارور از هسته جنگو عه
تصویری از مدلتون ارسال کنین
مشکل از مدل هستش
از وقتی که این مدل رو ساختم این مشکل پیش اومد
from django.contrib.auth.models import User
from django.db import models
# Create your models here.
class pay(models.Model):
owner = models.ForeignKey(User, models.CASCADE, verbose_name='کاربر')
amount = models.IntegerField('مبلغ')
payment_data = models.DateTimeField(null=True,blank=True,verbose_name='تاریخ و زمان پرداخت',auto_now_add=True)
successful = models.BooleanField(verbose_name='موفقیت آمیز')
status_code = models.CharField(verbose_name='کد پرداخت',max_length=10)
tracking_code = models.IntegerField(verbose_name='کد پیگیری', null=True, blank=True)
def __str__(self):
return f"{self.amount} - {self.owner.get_full_name()} - {self.status_code}"
class Meta:
verbose_name = 'پرداخت'
verbose_name_plural = 'پرداخت ها'
در پروژه آیا فیلدی با نام ggiui دارین؟
نه !
ولی هر وقت این اپلیکیشنی که توش این مدل هست رو از
اینستالد اپس پاک می کنم دیگه ارور نمیده
این خط کد اشتباهه دوست من
amount = models.IntegerField('مبلغ')
باید بهش verbose_name بدین
بهش verbose_name دادم ولی دوباره همین ارور رو داد !
الان اینجوریه:
from django.contrib.auth.models import User
from django.db import models
# Create your models here.
class pay(models.Model):
owner = models.ForeignKey(User, models.CASCADE, verbose_name='کاربر')
amount = models.IntegerField(verbose_name='مبلغ')
payment_data = models.DateTimeField(null=True,blank=True,verbose_name='تاریخ و زمان پرداخت',auto_now_add=True)
successful = models.BooleanField(verbose_name='موفقیت آمیز')
status_code = models.CharField(verbose_name='کد پرداخت',max_length=10)
tracking_code = models.IntegerField(verbose_name='کد پیگیری', null=True, blank=True)
def __str__(self):
return self.owner.get_full_name()
class Meta:
verbose_name = 'پرداخت'
verbose_name_plural = 'پرداخت ها'
و وقتی که makemigrations میزنم میگه تغییری یافت نشد
ارور :
1fmvo2kfic
nmnxpd76dke129wvpsyxoew0xcwov2qcp5jbch3sbk605g5ehc
Operations to perform:
Apply all migrations: Account, admin, auth, contenttypes, eshop_FAQ, eshop_contact, eshop_news, eshop_order, eshop_payment, eshop_products_category, esho
p_settings, eshop_sliders, eshop_tag, products, sessions
Running migrations:
Applying eshop_payment.0006_auto_20210728_1158...Traceback (most recent call last):
File "D:\ali_eshop\manage.py", line 22, in <module>
main()
File "D:\ali_eshop\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\base.py", line 398, in execute
output = self.handle(*args, **options)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\commands\migrate.py", line 244, in handle
post_migrate_state = executor.migrate(
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\migration.py", line 126, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\operations\fields.py", line 244, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\schema.py", line 140, in alter_field
super().alter_field(model, old_field, new_field, strict=strict)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\base\schema.py", line 594, in alter_field
self._alter_field(model, old_field, new_field, old_type, new_type,
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\schema.py", line 362, in _alter_field
self._remake_table(model, alter_field=(old_field, new_field))
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\schema.py", line 202, in _remake_table
'default': self.quote_value(self.effective_default(new_field))
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\base\schema.py", line 310, in effective_default
return field.get_db_prep_save(self._effective_default(field), self.connection)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\models\fields\__init__.py", line 842, in get_db_prep_save
return self.get_db_prep_value(value, connection=connection, prepared=False)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\models\fields\__init__.py", line 837, in get_db_prep_value
value = self.get_prep_value(value)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\models\fields\__init__.py", line 986, in get_prep_value
return self.to_python(value)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\models\fields\__init__.py", line 976, in to_python
raise exceptions.ValidationError(
django.core.exceptions.ValidationError: ['مقدار «ggiui» باید True یا False باشد.']
چون یکبار migration زده بودین و هنگام اجرا با ارور مواجه شده بود، برای همین چیز جدیدی پیدا نمیکنه
migration های قبلیتون رو پاک کنین و دوباره سعی کنین
ممنونم مایگریت بدون مشکل اجرا شد
ولی وقتی که میخام توی ادمین وارد بشم میگه :
و وقتی که مایگریت میزنم میگه
08sdf9vsfy
7z00qw7nl3l0dqa8ih63d7ruvj5nbgypgrhlgc1gtkwkhdv0zy
Operations to perform:
Apply all migrations: Account, admin, auth, contenttypes, eshop_FAQ, eshop_contact, eshop_news, eshop_order, eshop_payment, eshop_products_category, esho
p_settings, eshop_sliders, eshop_tag, products, sessions
Running migrations:
Applying eshop_payment.0002_rename_payment_data_pay_payment_date...Traceback (most recent call last):
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such column: "payment_data"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\ali_eshop\manage.py", line 22, in <module>
main()
File "D:\ali_eshop\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\base.py", line 398, in execute
output = self.handle(*args, **options)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\core\management\commands\migrate.py", line 244, in handle
post_migrate_state = executor.migrate(
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\migration.py", line 126, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\migrations\operations\fields.py", line 350, in database_forwards
schema_editor.alter_field(
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\schema.py", line 140, in alter_field
super().alter_field(model, old_field, new_field, strict=strict)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\base\schema.py", line 594, in alter_field
self._alter_field(model, old_field, new_field, old_type, new_type,
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\schema.py", line 360, in _alter_field
return self.execute(self._rename_field_sql(model._meta.db_table, old_field, new_field, new_type))
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\base\schema.py", line 145, in execute
cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\utils.py", line 98, in execute
return super().execute(sql, params)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\Desktop\ali_eshop\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such column: "payment_data"
همه migration ها از همه ی application ها رو باید پاک کنین دوست من
همه migration ها از همه ی application ها رو پاک کردم ولی وقتی که python manage.py migrate
میزنم میگه
2yb69pz97h
aglazcfvgkm7j1a0h6a73ec1alfmka670l5202ztr5sao4rh23
Operations to perform:
Apply all migrations: admin, auth, contenttypes, eshop_FAQ, eshop_contact, eshop_news, eshop_order, eshop_payment, eshop_products_category, eshop_setting
s, eshop_sliders, eshop_tag, products, sessions
Running migrations:
No migrations to apply.
دوست من باید اول همه migration ها رو پاک کنین و بعد یک migration کلی بزنین تا تغییرات دیتابیس برای سیستم مشخص بشه
الان هم اروری نداده و میگه migration ای وجود نداره که بخواد اعمال کنه
یک migration جدید بزنین و مجدد دستور migrate رو اعمال کنین
سلام منونم درست شد
بعدش من یه فیلد به سایت ستینگسز اضافه کردم و python manage.py makemigrations رو زدم این ارور رو داد:
959tzb71wy
dp7e372pdxewuhsbe8bsuak9bio6rf4m7c74elj7voe3jiksmu
Traceback (most recent call last):
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such column: eshop_settings_site_setting.SEO_description
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\ali_eshop\manage.py", line 22, in <module>
main()
File "D:\ali_eshop\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 393, in execute
self.check()
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 419, in check
all_issues = checks.run_checks(
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 412, in check
for pattern in self.url_patterns:
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 598, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 591, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "D:\ali_eshop\ali_eshop\urls.py", line 21, in <module>
from .views import (
File "D:\ali_eshop\ali_eshop\views.py", line 7, in <module>
settings = site_setting.objects.first()
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 674, in first
for obj in (self if self.ordered else self.order_by('pk'))[:1]:
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 280, in __iter__
self._fetch_all()
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 1324, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\sql\compiler.py", line 1175, in execute_sql
cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 98, in execute
return super().execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such column: eshop_settings_site_setting.SEO_description
الان مدلم این جوریه
from django.db import models
# Create your models here.
from products.models import get_filename_ext
def upload_image_path(instance, filename):
name, ext = get_filename_ext(filename)
final_name = f"{instance.site_title}-site_logo{ext}"
return f"site_settings/{final_name}"
class site_setting(models.Model):
site_title = models.CharField(max_length=150, verbose_name='عنوان کامل سایت')
site_title2 = models.CharField(max_length=50, verbose_name='عنوان سایت')
site_e_title = models.CharField(max_length=150, null=True, blank=True, verbose_name='عنوان انگلیسی سایت')
address = models.CharField(max_length=450, verbose_name='آدرس')
phone = models.CharField(max_length=20, verbose_name='تلفن تماس')
site_email = models.EmailField(verbose_name='ایمیل سایت')
site_logo = models.ImageField(upload_to=upload_image_path, null=True, blank=True, verbose_name="لوگو سایت")
about_us = models.TextField(verbose_name="درباره ی ما")
map = models.CharField(max_length=500,verbose_name='نقشه',help_text='برای بدست آوردن کد api به سایت گوگل مپ مرجعه فرمایید')
SEO_description = models.CharField(verbose_name="توضیحات برای SEO",max_length=170)
def __str__(self):
return self.site_title
class Meta:
verbose_name = 'تنظیمات'
verbose_name_plural = 'مدیریت تنظیمات'
فیلدی که اضافه کردین رو ارسال کنین
SEO_description = models.CharField(verbose_name="توضیحات برای SEO",max_length=170)
مقداری گمراه کننده شده این مشکل
لطفا تمامی migration های خودتون رو پاک کنین و مجدد migration بزنین
تمامی migration های رو پاک کردم و مجدد migration زدم ولی دوباره همون ارور رو داد
دیتابیس رو پاک کنین، مایگریشن ها رو هم همینطور و مجدد تست کنین
دیتابیس رو پاک کردم، مایگریشن ها رو هم همینطور ولی وقتی که میخوام دوباره مایگریشن بزنم این ارور رو میده:
0i1bvx83kc
8x0r6ry49ojktahztphj8ettha2jcsidp82jalolyjxeuia41u
Traceback (most recent call last):
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: eshop_settings_site_setting
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\ali_eshop\manage.py", line 22, in <module>
main()
File "D:\ali_eshop\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 398, in execute
output = self.handle(*args, **options)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 89, in
wrapped
res = handle_func(*args, **kwargs)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\migrate.py",
line 75, in handle
self.check(databases=[database])
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 419, in check
all_issues = checks.run_checks(
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\registry.py", line 76, in
run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 412, in check for pattern in self.url_patterns:
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 598, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 591, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "D:\ali_eshop\ali_eshop\urls.py", line 22, in <module>
from .views import (
File "D:\ali_eshop\ali_eshop\views.py", line 7, in <module>
settings = site_setting.objects.first()
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 674, in first
for obj in (self if self.ordered else self.order_by('pk'))[:1]:
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 280, in __iter__
self._fetch_all()
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 1324, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\models\sql\compiler.py", line 1175, in execute_sql
cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 98, in execute
return super().execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: eshop_settings_site_setting
یک پروژه جدید ایجاد کنین و کدتون رو بدون مایگریشن ها به پروژه جدید منتقل کنین
همین کار رو کردم ولی این ارور رو میده
vzmzv90tdf
jdapqj6do1gc0a7ebj1186tmg1fy7192v7yvu88vruxyy57zxp
Traceback (most recent call last):
File "D:\hamid_eshop\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "D:\hamid_eshop\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such column: eshop_settings_site_setting.SEO_description
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\hamid_eshop\manage.py", line 22, in <module>
main()
File "D:\hamid_eshop\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "D:\hamid_eshop\venv\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "D:\hamid_eshop\venv\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\hamid_eshop\venv\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\hamid_eshop\venv\lib\site-packages\django\core\management\base.py", line 393, in execute
self.check()
File "D:\hamid_eshop\venv\lib\site-packages\django\core\management\base.py", line 419, in check
all_issues = checks.run_checks(
File "D:\hamid_eshop\venv\lib\site-packages\django\core\checks\registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "D:\hamid_eshop\venv\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "D:\hamid_eshop\venv\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "D:\hamid_eshop\venv\lib\site-packages\django\urls\resolvers.py", line 412, in check
for pattern in self.url_patterns:
File "D:\hamid_eshop\venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "D:\hamid_eshop\venv\lib\site-packages\django\urls\resolvers.py", line 598, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "D:\hamid_eshop\venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "D:\hamid_eshop\venv\lib\site-packages\django\urls\resolvers.py", line 591, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\Ali Rahmani\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "D:\hamid_eshop\hamid_eshop\urls.py", line 22, in <module>
from .views import (
File "D:\hamid_eshop\hamid_eshop\views.py", line 7, in <module>
settings = site_setting.objects.first()
File "D:\hamid_eshop\venv\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "D:\hamid_eshop\venv\lib\site-packages\django\db\models\query.py", line 674, in first
for obj in (self if self.ordered else self.order_by('pk'))[:1]:
File "D:\hamid_eshop\venv\lib\site-packages\django\db\models\query.py", line 280, in __iter__
self._fetch_all()
File "D:\hamid_eshop\venv\lib\site-packages\django\db\models\query.py", line 1324, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "D:\hamid_eshop\venv\lib\site-packages\django\db\models\query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "D:\hamid_eshop\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1175, in execute_sql
cursor.execute(sql, params)
File "D:\hamid_eshop\venv\lib\site-packages\django\db\backends\utils.py", line 98, in execute
return super().execute(sql, params)
File "D:\hamid_eshop\venv\lib\site-packages\django\db\backends\utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "D:\hamid_eshop\venv\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "D:\hamid_eshop\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "D:\hamid_eshop\venv\lib\site-packages\django\db\utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "D:\hamid_eshop\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "D:\hamid_eshop\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 423, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such column: eshop_settings_site_setting.SEO_description