Could someone please help me and answer my question in the last email?

Thank you.
Nanda

On Jul 19, 9:52 pm, nandu <navanitach...@gmail.com> wrote:
> Dear All,
>
> I have now set up my subdomains as separate sites using the sites
> framework but I have a few queries:
>
> 1. Does each site really require a separate django instance or can I
> run all the subdomains on one instance? I have seven subdomains and
> running seven django instances seems wasteful.
>
> 2. Currently I have a Django app corresponding to each subdomain since
> each subdomain now needs a unique settings.py file is it ok to have
> the settings file within the app or is it necessary for the app to
> become a project in this case a project within a project?
>
> 3. Is it OK for me to put all my urls in the one single urls.py file
> or would it be best to separate them on a per app basis.
>
> I just need a pointer in the right direction since I have never used
> the sites framework before, and as far as I know I could not find too
> many tutorials or howtos on how to use it either.
>
> Thank you for all the help all of you have given me so far.
>
> Yours sincerely,
> Nanda
>
> On Jul 19, 3:00 pm,nandu<navanitach...@gmail.com> wrote:
>
> > Thank you to all whohave replied.
>
> > I will give the sites framework an honest effort and solve my problem.
>
> > Thank you very much for your time and effort. :-)
>
> > Nanda
>
> > On Jul 19, 2:42 pm, jaymzcd <jaym...@googlemail.com> wrote:
>
> > > Like Daniel & Steve have said already, urls.py only deals with the
> > > path component of the URL, not the domain. The sites framework is what
> > > you need to use, its pretty simple. All you really need to do is
> > > something like:
>
> > > 1. in urls.py match the URL you want that is common for both
> > > subdomains
> > > 2. in your view for that pattern get the current site id
> > > 3. based on what subdomain (site) is returned execute the appropriate
> > > function
>
> > > urls.py *cant* know about the subdomain.  If you have an aversion to
> > > using the sites framework you could maybe hack it to work by looking
> > > at the contents of request.META['SERVER_NAME'] in your view but i
> > > wouldnt do that. Check the sites framework...
>
> > > jaymz
>
> > > On Jul 19, 7:05 am,nandu<navanitach...@gmail.com> wrote:
>
> > > > Thank you to all who have replied to my query.
>
> > > > I do not think I need to use the sites framework because my subdomains
> > > > are not on different servers and hence are not really different sites.
> > > > Possibly what I am working with are actually pseudo-subdomains and not
> > > > subdomains in the real sense. I will explain what I am intending to do
> > > > below:
>
> > > > Let us say that I have a domain "example.com"
>
> > > > This site contains subdomains like the following:
>
> > > > subdomain1.example.com
> > > > subdomain2.example.com
>
> > > > and so on.
>
> > > > In my urls.py if I want to map the subdomain1.example.com to some
> > > > function and I need to know what regular expression I should use.
> > > > Another problem I am facing is that I testing this on localhost so I
> > > > need to get a URL that I believe looks like "subdomain1.127.0.0.1:
> > > > 8000" instead if "127.0.0.1:8000/subdomain1" and get urls.py to
> > > > recognise this. I know that I may need to write a middleware class
> > > > that intercepts every URL which I have implemented but I have no idea
> > > > how to specify the URL in my href attribute in my link.
>
> > > > so that it is taken as subdomain1.127.0.0.1: 8000 instead of
> > > > 127.0.0.1:8000/subdomain1 which is incorrect.
>
> > > > FYI
> > > > I am working on a Ubuntu Linux machine and the Django development
> > > > server.
>
> > > > I am sorry if I have misunderstood your answers above but IMHO I do
> > > > not think I need to use the sites framework as this is a fairly simple
> > > > thing.
>
> > > > Thank you.
>
> > > > Yours sincerely,
> > > > Nanda
>
> > > > On Jul 18, 1:47 am, Steve Holden <holden...@gmail.com> wrote:
>
> > > > > On 7/17/2010 12:38 PM,nanduwrote:
>
> > > > > > Dear Folks,
>
> > > > > > After researching the topic of using subdomains with Django I have
> > > > > > found that it is does not seem to be a straight forward thing to do.
>
> > > > > > I have also found many websites showing methods of how to do this, 
> > > > > > but
> > > > > > there is one aspect that none of them seem to explain. That is how
> > > > > > does one specify the URL for the subdomain in urls.py if I had a
> > > > > > subdomain like "something.example.com".
>
> > > > > > I would also appreciate it if someone could point me in the right
> > > > > > direction in terms of how to use subdomains with django as each
> > > > > > website seems to specify a different method, and I have no idea 
> > > > > > which
> > > > > > one is the best. The URLs of the websites I have looked at are 
> > > > > > below:
>
> > > > > >http://uswaretech.com/blog/2008/10/using-subdomains-with-django/
>
> > > > > >http://thingsilearned.com/2009/01/05/using-subdomains-in-django/
>
> > > > > >http://www.nerdydork.com/django-accounts-on-subdomains.html
>
> > > > > >http://djangosnippets.org/snippets/1119/
>
> > > > > > I am also looking for a solution that avoids making many changes to
> > > > > > the web application when it is about to be deployed.
>
> > > > > > Please forgive my ignorance in this matter.
>
> > > > > Servers in different subdomains are different sites, so you may want 
> > > > > to
> > > > > read up about Django's sites framework.
>
> > > > >    http://docs.djangoproject.com/en/dev/ref/contrib/sites/
>
> > > > > regards
> > > > >  Steve
> > > > > --
> > > > > Steve Holden           +1 571 484 6266   +1 800 494 3119
> > > > > DjangoCon US September 7-9, 2010    http://djangocon.us/
> > > > > See Python Video!      http://python.mirocommunity.org/
> > > > > Holden Web LLC                http://www.holdenweb.com/
>
> > > > > --
> > > > > Tel/Toll-free:       +1 571 484 6266     +1 800 494 3119
> > > > > DjangoCon US September 7-9, 2010    http://djangocon.us/
> > > > > See Python Video!      http://python.mirocommunity.org/
> > > > > Holden Web LLC                http://www.holdenweb.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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