I've had a similar problem on many of my python projects, where a package
seems to be on the pythonpath and everything is perfect but for some reason
I can't import it. Almost always the problem is that I forgot to include an
__init__.py in the package. If a directory does not have an __init__.py,
python will not consider it a package and it will not be importable.

Chris

On Sat, Feb 7, 2009 at 1:55 PM, Steve Holden <holden...@gmail.com> wrote:

>
> Joshua Russo wrote:
> >
> > On Feb 3, 6:04 pm, Adam Yee <adamj...@gmail.com> wrote:
> >
> >> On Feb 3, 9:49 am, Joshua Russo <joshua.rupp...@gmail.com> wrote:
> >>
> >>
> >>> I'm working through the tutorials and have encountered a strange
> >>> problem. So far everything works but Python doesn't acknowledge my
> >>> base site as a package. So everywhere that you see a reference like
> >>> "mysite.poll" I need to use only "poll". I think that my problems stem
> >>> from the following section that starts on line 263 of tutorial01.txt:
> >>>
> >> Make sure you're not mispelling 'polls'.  You've typed 'poll' above.
> >> If you're talking about the settings, yes you don't need to specify
> >> mysite.polls since the settings.py file is already in the mysite
> >> directory.  You could just put 'polls' into installed apps.
> >>
> >>
> >>
> >>
> >>
> >>
> >>> To create your app, make sure you're in the :file:`mysite` directory
> >>> and type
> >>> this command:
> >>>
> >>> .. code-block:: bash
> >>>
> >>>     python manage.py startapp polls
> >>>
> >>> I ran the above command from my MySite directory that holds the
> >>> manage.py file. Is that correct? Anyone have any ideas why I can't
> >>> reference my base package? (I think I'm using the term package
> >>> correctly here.)
> >>>
> >>> Thanks
> >>> Josh
> >>>
> >> As far as I see your doing it correctly.  For technical purposes, the
> >> way that I see it (and the way django defines it):
> >> mysite = project
> >> polls = app
> >> I'm not quite sure what you're referring to as base package.  Hope
> >> this helps.
> >>
> >
> > Ya, what you suggest for settings.py is what I did. I just wanted to
> > make sure that I wasn't doing something wrong in my order of
> > operations for creating my project and app.
> >
> > I'm most of the way though part two of the tutorial and have run into
> > three places where I needed to remove "mysite." from in front of the
> > reference to polls. Once for the settings.py like you mentioned and
> > twice for the two tables in the admin.py in the second part of the
> > tutorial. It seems to me it's just a "bug" in the tutorial.
> >
> Technically the only requirement is that apps be loadable, so you can
> have an app anywhere on your PYTHONPATH and import it into several sites
> (assuming you want all thoses sites to share the same code). As long as
> each site has its own settings there should be no interference.
>
> The thing you should avoid at all costs is importing the same module
> into the same site under different names - that *will* cause confusion.
>
> regards
>  Steve
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to