Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » trying to do console testing of my models, "no module named X" [RSS Feed]

#1 June 24, 2010 05:04:41

r.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

trying to do console testing of my models, "no module named X"


I have a django project running on local linux machine with apache. I
run this at localhost:8081 and I use import statements to import my
models in my views (e.g. "from DjangoSite.ManageProducts.models import
Member").

For testing, I want to be able to import my models into python console
and run test queries. I don't know how python knows where my models
are...when I run import statement in python console, it comes back
with error "no module named DjangoSite.ManageProducts.models".

How do I references my own modules using console? Do I need to add my
project to python path?

Thanks

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 24, 2010 08:03:07

e.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

trying to do console testing of my models, "no module named X"


If you do:

python manage.py shell

you will get a python shell with all the necessary paths set up so
that you can do your testing. You may also want to consider some sort
of automated testing as it makes this sort of thing a lot easier and
quicker.

Euan

On 24 June, 05:04, robinne <develo...@computer-shoppe.net> wrote:
> I have a django project running on local linux machine with apache. I
> run this at localhost:8081 and I use import statements to import my
> models in my views (e.g. "from DjangoSite.ManageProducts.models import
> Member").
>
> For testing, I want to be able to import my models into python console
> and run test queries. I don't know how python knows where my models
> are...when I run import statement in python console, it comes back
> with error "no module named DjangoSite.ManageProducts.models".
>
> How do I references my own modules using console? Do I need to add my
> project to python path?
>
> Thanks

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » trying to do console testing of my models, "no module named X" [RSS Feed]

Board footer

Moderator control

Enjoy the 19th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support