-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fresh project runs into ERROR: value too long for type character varying(50)
#4519
Comments
It fails to create a row in one table, because one You haven't shared a lot of logs, so we don't see which migration fails. However, since you're claiming that it's a fresh project and that the size of the column is 50, I bet it's failing on Lines 12 to 18 in bd153d0
The Line 31 in bd153d0
Did you redact the value of your project name by any chance? Is the actual value longer than 50 char? If that's the case, I suggest you to edit the name of the site in your migration As for a fix to the template itself, we could limit the length of the value in the migration: def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
_update_or_create_site_with_sequence(
Site,
schema_editor.connection,
"{{cookiecutter.domain_name}}",
- "{{cookiecutter.project_name}}",
+ "{{cookiecutter.project_name[:50]}}",
) |
alright, just a quick update. I've created another project with the same settings but a different project name (shorter). The above error is gone and I have 26 passing tests. I'll investigate it further later today or tomorrow to make sure it was related to the length of the project name, just FYI the exception was thrown on multiple occasions including your suspected sites app. so far, thx for the response. |
now I've recreated the project with exactly the same inputs as yesterday but I couldn't reproduce the issue. so whatever it was, it was fixed by one of the last commits in between my try yesterday and today. since I'm not able anymore to reproduce I'll just close this issue. |
What happened?
you can hit the same issue with running pytest or manage.py migrate (inside docker container)
I created a new project with the following settings:
then run
docker-compose up
(or start a container/django env else and run into the same issue) and run into:What should've happened instead?
not hitting the exception
Additional details
I tried it again with psycopg[c]==3.1.10 without a immediate difference
Host system configuration:
cookiecutter --version
): Cookiecutter 2.3.0 (via homebrew)ProductName: macOS
ProductVersion: 13.4.1
ProductVersionExtra: (c)
BuildVersion: 22F770820d
Python version, run
python3 -V
: 3.11.4 (docker)Docker version (if using Docker), run
docker --version
: Docker version 24.0.2, build cb74dfcdocker compose version (if using Docker), run
docker compose --version
: Docker Compose version v2.19.1 (FYI it's meanwhile docker compose version without double dash)Options selected and/or replay file:
On Linux and macOS:
cat ${HOME}/.cookiecutter_replay/cookiecutter-django.json
The text was updated successfully, but these errors were encountered: