[EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote:
> > Try this:
> >
> > import sys
> > import os
> > sys.path.append('path to where mysite is')
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
> >
> > from mysite.myapp.views import *
> > from mysite.myapp.models import *
>
> Thx - it works - but why?
> ;-)
>

Which part?

You need to add the path so it knows where the base of the later "from
... import ..." is.  Basically it will look for:
/path_to_mysite/mysite/myapp/models.py and the same for views.

You need the DJANGO_SETTINGS_MODULE thing so it knows all of the rest
of the settings info.

Then you simply import your models and views and use them as regular
python objects.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to