tags:

views:

69

answers:

3

When I run python ./manage.py sql grading my django site comes up with:

Error: App with label grading could not be found. Are you sure you INSTALLED_APPS setting is correct?

I have the app grading with __init__.py and everything, and my INSTALLED APPS is:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'teachline.courses',
    'teachline.grading',
)

Why isn't this working?

A: 

Do you have a directory which contains teachline in your PYTHONPATH environment variable? It may be necessary to export PYTHONPATH="." to make things work.

nailxx
I tried changing PYTHONPATH, but it didn't work. Running `python manage.py sql courses` works; `grading` is the only app it doesn't work for.
cml
How did you create your app? By using `startapp` command? Does it have models.py inside app directory.
rebus
And does it have `__init__.py`?
nailxx
A: 

Okay, I found what was going wrong. I ran python manage.py shell and tried to import teachline.grading.models. It turned out I had some problems with importing modules. I fixed those and now python manage.py sql grading works fine.

cml
A: 

Does the file teachline/grading/__init__.py file exist in the pythonpath.

Lakshman Prasad