Opened 9 years ago

Closed 9 years ago

#11308 closed (duplicate)

Django ignores an application if it's trying to import a module that doesn't exist

Reported by: rynoinstereo Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:



First off, I'm a brand new Django user so apologies if I don't make myself clear.

Just had a weird thing happen where I could not for the life of me, figure out why Django was saying all my Models were valid, yet when running validate and then syncdb, it would not create the tables for my newly created application.

The problem turned out to be that I was trying to include a model from one of my other applications ina the project but I had the name of the model wrong.

For some reason, this caused Django to completely ignore the model file for my newly created application, instead of reporting this as an error?

Change History (2)

comment:1 Changed 9 years ago by Russell Keith-Magee

Component: Testing frameworkDatabase layer (models, ORM)
milestone: 1.1
Triage Stage: UnreviewedAccepted

This is certainly annoying, but it isn't critical for v1.1 as it doesn't cause data loss.

The problem is that we are a bit enthusiastic eating ImportErrors during the loading process. There is a legitimate reason for catching ImportErrors; they are a byproduct of the the app loading process. However, errors such as this one should be raised to the user, rather than being eaten entirely.

Explicit reproduction instructions: Create a new application called 'testapp', and add it to Put the following in testapp/

from django.db import models

from django.contrib.auth.models import NotAModel

class NewModel(models.Model):
    name = models.CharField(max_length=200) validate doesn't report errors; syncdb doesn't report any problems, but doesn't create the testapp_newmodel table, either.

comment:2 Changed 9 years ago by Dennis Kaarsemaker

Resolution: duplicate
Status: newclosed

Duplicate of #10706

Note: See TracTickets for help on using tickets.
Back to Top