zinmyoswe / Django-Ecommerce

Ecommerce website built with Django 2.2.3, Python 3.7.3, Stripe and AWS

Home Page:https://zinmyo2141.pythonanywhere.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

django.db.utils.DataError: value too long for type character varying(1)

devopsenggineer opened this issue · comments

hey there,

i was trying add and use postgres as backend database to this project, but i was getting this blow errors when i executed this command: python3 manage.py migrate
"psycopg2.errors.StringDataRightTruncation: value too long for type character varying(1)"
"django.db.utils.DataError: value too long for type character varying(1) "

here is the full log message.

(Django-Ecommerce) osboxes@osboxes:~/djangotest/Django-Ecommerce$ python3 manage.py migrate
Operations to perform:
  Apply all migrations: account, admin, auth, contenttypes, core, sessions, sites, socialaccount
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying account.0001_initial... OK
  Applying account.0002_email_max_length... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying core.0001_initial... OK
  Applying core.0002_auto_20191105_0426...Traceback (most recent call last):
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.StringDataRightTruncation: value too long for type character varying(1)


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 234, in handle
    fake_initial=fake_initial,
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/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 "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/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 "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 112, in database_forwards
    field,
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 447, in add_field
    self.execute(sql, params)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 137, in execute
    cursor.execute(sql, params)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/backends/utils.py", line 99, in execute
    return super().execute(sql, params)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/osboxes/djangotest/Django-Ecommerce/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.DataError: value too long for type character varying(1)

what exactly needs to be done to resolve this issue.
Feel free to ask any questions regarding this issue.
thanks and regards.