On Thu, 2007-03-15 at 11:11 -0700, Michael Cuddy wrote:
> 
> When importing modules, I think that it's ugly to have to use the 
> 'site' name on modules ... f'rinstance:
> 
>     from mysite.myapp.views import MyView, MyOtherView
>     from mysite.myapp.models import MyModel, MyOtherModel
> 
> From a modularity standpoint, it would be much nicer to just 
> say:
> 
>     from myapp.views import MyView, MyOtherView
>     from myapp.models import MyModel, MyOtherModel
> 
> That way apps can be moved around between sites, without having to edit
> them for the new site name
> 
> This works if I use 'manage.py shell', but does not work when 
> I runapp.
> 
> Any suggestions?

It's should just be a question of where your Python path is pointing: by
default, manage.py will include both the project directory and the
parent of the project directory in the Python path. When you are using a
production web server, you need to specify the Python path manually and
it's entirely up to you how you set that up. I use the latter form of
imports all the time in my work -- if all the apps are under a single
project directory (which isn't always true), I point the Python path to
the project directory itself, not it's parent.

If this doesn't make sense, maybe you could post the relevant portion of
your webserver configuration.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to