On Saturday, February 19, 2011 10:52:50 AM UTC, Rohini Dhavale wrote:
>
> As per the tutorials I am trying to create my own project. Followed
> every step up to creating database; syncdb. But in interactive shell
> when trying out ' from student_cce.models import abhivyakti ' command
> where student_cce is name of my project model and abhivyakti is name
> of my databse table it is giving me error : ' ImportError: cannot
> import name abhivyakti ' where I have already defined abhivyakti as
> model in settings.py. Please give me the solution.
This is a basic Python question. When using import, you need to give the
fully-qualified module that you are importing. As you can see from your own
directory structure, you have a directory called 'abhivyakti', which is the
application, and inside that is a file called 'models.py', which contains
the actual model names (which you haven't given).
So either do `from abhivyakti import models` - and now you can reference
your model classes via `models.MyModelName` - or `from abhivyakti.models
import MyModelName`, and just refer to MyModelName.
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.