I have a Django project which has two apps (one created as debug test). For the debug test, syncdb does put the model in the database but for the other it does not.
settings.INSTALLED_APPS
.for model in get_models():
models.append(model)
pass models to a template
Any help would be much appreciated. I think it is something trivial but I'm out of ideas for things to try.
Thanks,
UPDATE:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.admin',
'techtree',
'froink',
)
Structure:
project/techtree/models.py
(contains a test model) project/techtree/models/__init__.py
(as described here)project/techtree/models/typ.py
(contains model Type) There are more files of the same type as the last line.
Are you missing the __init__.py
file in the second app's models directory? That would mean it can't be found on the path.
Can you show us your INSTALLED_APPS
setting, and your directory structure please?
Looking at your directory structure, I think I can guess what's wrong.
my_app/
__init__.py
my_module.py
my_module/
__init__.py
my_python_file.py
With the above fictional directory structure, what gets imported when I do the following?
from my_module import *
Does that import everything from within my_module.py
or everything within the my_module
directory?
Use one, or the other. Not both. Put everything inside your models.py
file, and get rid of the directory unless you have a good reason for having a models
directory. You probably don't.