Thursday, 3 October 2013

Django application database error: No module named

Django application database error: No module named

I was trying to connect my database application to project in django.
Succeded on connecting psycopg and database. Then I started to build
application for it by
python manage.py startapp books
and wrote some code in models.py.
But when I tried to put application in INSTALLED_APPS, it caused on error.
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'tut1.books',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
So, I'm in project's folder and type in Command Line:
%>python manage.py syncdb
ImportError: No module named 'tut1.books'
If I remove my app from INSTALLED_APPS, everything goes fine. I suspect,
there gotta be different syntax for linking application.
Tried to change 'tut1.books' to just 'books'. Causes another error.
%>python manage.py syncdb
AttributeError:'module' object has no attribute 'URLFIELD'