Russ,

Phew - you set me on the right track there.  I actually had an app
called events at the same level as the main app

/django
   /appwithproblem
       /web
       /events
   /events
      /web


There are various errors reported - like the above .__init__ one where
python behaves correctly but not in the way some newbies might
expect.  Be great to write an app that looked for all these possible
errors  - called "dont_do_that" maybe.  If I had a spare 5 mins....


Thanks so much.




On Sep 3, 12:39 am, Russell Keith-Magee <freakboy3...@gmail.com>
wrote:
> On Wed, Sep 2, 2009 at 11:38 PM, phoebebright<phoebebri...@spamcop.net> wrote:
>
> > And it's not a missing __init__.py program that I can see.
>
> > Am trying to move a site to a new server - CentOS to Ubuntu and
> > version of python are changing from 2.4.3 to 2.5.2 and using wsgi now
> > instead of mod_python.
>
> > I already have one django site running on the new server so the basic
> > setup is ok.
> > The old site runs fine on the old server
> > But when I copy the code across, and the data, and change the settings
> > and try to run I get
>
> > ViewDoesNotExist
> > Exception Value:
> > Could not import towns.town.views. Error was: No module named models
>
> > The offending line seems to be:
> >      from events.models import Event
>
> > There is an events app off the main directory
> > It has a __init__.py
> > There is a models.py and it does contain a class Event
> > The paths look fine.
>
> > I've deleted and recopied the whole lot, restarted apache countless
> > times, deleted the offending line and it just falls over on the next
> > reference to the events.model file.
>
> > Googled till I'm cross eyed - I bet it's something simple but I'm
> > baffled!
>
> > An ideas gratefully received.
>
> One possible cause is a naming confusion. Take the following directory
> structure:
>
> events/
>     __init__.py
>     models.py
> stuff/
>     __init__.py
>     events.py
>     utils.py
>
> In this situation, if utils.py includes "from events.models import
> Event", you will get the error you describe because the 'events'
> module that is found is actually stuff.events, not the top level
> events.
>
> This error can even persist after you delete the events.py - if
> events.pyc still exists in the stuff directory, it will get used in
> preference to the actual code module.
>
> I don't know if this is your problem specifically, but this has bitten
> me in the past.
>
> Yours,
> Russ Magee %-)
--~--~---------~--~----~------------~-------~--~----~
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