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

I have a signup form on my Django app deployed on Heroku.

It is working fine except for one thing.

When I try to add new data to the database by getting the data from my signup form, it does not add the data.

In the logs of my Heroku, it shows this:

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

From this, what I understand is that any of my model's fields has a 50 max length and I'm giving the data more than that limit. --might be possible

But when I changed the max length from 50 to 150, and tried to migrate the changes in Heroku using heroku run python migrate

after making the migrations using makemigrations mehtod, it shows the following error in the console:

File "/app/", line 22, in <module>
File "/app/", line 18, in main
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/", line 446, in execute_from_command_line
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/", line 440, in execute
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/", line 460, in execute
    output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/", line 98, in wrapped
    res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/commands/", line 290, in handle
    post_migrate_state = executor.migrate(
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/migrations/", line 131, in migrate
    state = self._migrate_all_forwards(
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/migrations/", line 163, in _migrate_all_forwards
    state = self.apply_migration(
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/migrations/", line 248, in apply_migration
    state = migration.apply(state, schema_editor)
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/migrations/", line 131, in apply
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/migrations/operations/", line 108, in database_forwards
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/base/", line 599, in add_field
    definition, params = self.column_sql(model, field, include_default=True)   
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/base/", line 345, in column_sql
    " ".join(
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/base/", line 296, in _iter_column_sql
    default_value = self.effective_default(field)
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/base/", line 410, in effective_default
    return field.get_db_prep_save(self._effective_default(field), self.connection)
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/backends/base/", line 388, in _effective_default
    default = field.get_default()
File "/app/.heroku/python/lib/python3.10/site-packages/django/db/models/fields/", line 918, in get_default
    return self._get_default()
TypeError: uuid3() missing 2 required positional arguments: 'namespace' and 'name'

Again from which What I understood, uuid3 is missing some arguments but the thing is I haven't used UUID anywhere in my project.

So basically, I have some errors in my models but I can't migrate the changes on Heroku because of this error. What can I do?

My model:

class NewUser(models.Model):
    id = models.AutoField(primary_key=True)
    unique_id = models.CharField(max_length=21,)
    firstName = models.CharField(max_length=150, default=None)
    lastName = models.CharField(max_length=150, default=None)
    userEmail = models.CharField(max_length=150, default=None)
    userPassword = models.CharField(max_length=150, default=None)

If you want any other file you can mention, I'll edit the answer accordingly.


Константы Python: Улучшение управляемости вашего кода

Современный Python: начинаем проект с pyenv и poetry

Настройка проекта Python — виртуальные среды и управление пакетами

Использование requests в Python — тайм-ауты, повторы, хуки

Понимание декораторов в Python

ProcessPoolExecutor в Python: полное руководство

map() против submit() с ProcessPoolExecutor в Python

Понимание атрибутов, словарей и слотов в Python

Полное руководство по slice в Python

Выпуск Django 4.0

Безопасное развертывание приложения Django с помощью Gunicorn, Nginx и HTTPS

Автоматический повтор невыполненных задач Celery

Django REST Framework и Elasticsearch

Докеризация Django с помощью Postgres, Gunicorn и Nginx

Асинхронные задачи с Django и Celery

Релизы безопасности Django: 3.2.4, 3.1.12 и 2.2.24

Выпуски исправлений ошибок Django: 3.2.3, 3.1.11 и 2.2.23

Эффективное использование сериализаторов Django REST Framework

Выпуски безопасности Django: 3.2.2, 3.1.10 и 2.2.22

Выпущенные релизы безопасности Django: 3.2.1, 3.1.9 и 2.2.21

View all tutorials →