Might also want to try django multihost :)

On Tue, Feb 15, 2011 at 9:58 AM, Aryeh Leib Taurog <v...@aryehleib.com>wrote:

> On Feb 14, 5:08 am, Jason Drane <drane.ja...@gmail.com> wrote:
> > Forgive me if this question  offends you more advanced users. I am
> > begun down the road of learning Django. I am curious if it is possible
> > to place Django in the root of my server and reference it to each of
> > multiple sites in development, similar to php, python, etc.
>
> This kind of question comes up now and then.  I believe this setup
> isn't recommended.  However, it's not difficult to do, either.  I
> think it makes a lot of sense for someone with several small low-
> traffic sites, especially where server resources are limited (say on a
> shared host account).  You could accomplish this by configuring the
> web server to map each domain to a different base path in the url.
> For example, using lighttpd/fastcgi you would have something like
> this:
>
> #--- lighttpd.conf --
> fastcgi.server = (
>   "/django.fcgi" => (
>        "main" => ( "socket" => "/var/www/django.sock", "check-local"
> => "disable", )
>   )
> )
>
> $HTTP["host"] == "site1.example.com" {
>    alias.url = ( "/static" => "/var/www/site1/static" )
>    url.rewrite-once = (
>        "^(/static/.*)$" => "$1",
>        "^(/.*)$" => "/django.fcgi/site1$1",
>    )
> }
>
> $HTTP["host"] == "secondsite.example.com" {
>    alias.url = ( "/static" => "/var/www/secondsite/static" )
>    url.rewrite-once = (
>        "^(/static/.*)$" => "$1",
>        "^(/.*)$" => "/django.fcgi/secondsite$1",
>    )
> }
> #-----
>
> Then you set up your django urls like this
>
> #--- urls.py
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('',
>                       url(r'^site1/', include('site1.urls')),
>                       url(r'^secondsite/',
> include('secondsite.urls')),
> )
> #-----
>
> --
> 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.
>
>

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