Saturday, May 18, 2013

Re: no module name error

Ok.  If catalog is in the upper directory, take the leading "ecomstore." off of the import statement.  Also remove it from the entry in INSTALLED_APPS.

Alternatively, move the catalog directory (will all of its contents), into the lower directory. If you are at a unix or mac os shell prompt the 'mv' command will do this for you.  If you are on Windows or in a GUI drag and drop may work, but you're on your own to know how to do it.

Things in the upper directory are directly available for import, without prefixing them with the project name.  That whole directory is on sys.path (as "") because that was the current directory when you typed "python manage.py ...".  The name of this directory actually doesn't matter to Django and Python.  The lower ecomstore is a python package (directory with an __init__.py) in the upper directory, so *THAT* package can be imported with:

   import ecomstore

and things inside that package can be imported by prefixing its name to theirs (ecomstore.settings, ecomstore.url, ecomstore.wsgi, and, if you move the catalog package there, ecomstore.catalog).


On Sat, May 18, 2013 at 7:31 PM, kakararunachalservice <kakararunachalservice@gmail.com> wrote:

Its in the upper directory, i.e. where the manage.py is.



Sent from Samsung tablet


Bill Freeman <ke1g.nh@gmail.com> wrote:


Yes, but of which directory is the catalog directory a sub-directory?  The upper ecomstore (which contains manage.py) or the lower ecomstore (which contains settings.py)?  Or is it somewhere else entirely?



On Sat, May 18, 2013 at 6:59 PM, Kakar Arunachal Service <kakararunachalservice@gmail.com> wrote:
ecomstore is the project name. And within it, it has another ecomstore, which has the __init__.py, settings.py, urls.py and wsgi.py. And yes catalog too has the __init__.py file in it, as it was created by the startapp command. The error says, import error: no module named catalog.models in admin.py line 2, which is, from ecomstore.catalog.models import Category Product.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
  

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate