Giter VIP home page Giter VIP logo

Comments (3)

browniebroke avatar browniebroke commented on June 16, 2024

It fails to create a row in one table, because one CharField value is too long for the column in the database.

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 sites.0003_set_site_domain_and_name, which creates the site into the DB table from Django's sites framework:

site, created = site_model.objects.update_or_create(
id=settings.SITE_ID,
defaults={
"domain": domain,
"name": name,
},
)

The name is 50 char long:

("name", models.CharField(max_length=50, verbose_name="display name")),

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 sites.0003_set_site_domain_and_name. AFAIK, it's just an internal alias for you project name within the admin, it doesn't affect what the users will see. Let me know it it fixes your issue.

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]}}",
    )

from cookiecutter-django.

elmcrest avatar elmcrest commented on June 16, 2024

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.

from cookiecutter-django.

elmcrest avatar elmcrest commented on June 16, 2024

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.

from cookiecutter-django.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.