Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 28, 2010 11:43:27

M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Replace URLResolver?


Hi.

I would like to use subdomains in my URL-dispatch. Thats not supported
by Django.

Is it possible to replace Django URLResolver with my own? Must this be
done as a Middleware class?

(Why is Django URL resolver not implemented as a Middleware class?)

Input appreciated.

Thanks.

/Martin

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 28, 2010 16:05:12

Brian B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Replace URLResolver?


I don't know why the URL dispatcher doesn't support subdomains.

If I were to guess though, it would be that supporting subdomains and
virtual hosts is typically the responsibility of the web server. I think
Django didn't want to enable folks to do in python what apache and nginx
already do so well (and in a more optimized way).

my 2 cents,
Brian

On Tue, Dec 28, 2010 at 6:43 AM, Martin <martins...@gmail.com> wrote:

> Hi.
>
> I would like to use subdomains in my URL-dispatch. Thats not supported
> by Django.
>
> Is it possible to replace Django URLResolver with my own? Must this be
> done as a Middleware class?
>
> (Why is Django URL resolver not implemented as a Middleware class?)
>
> Input appreciated.
>
> Thanks.
>
> /Martin
>
> --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>


--
Brian Bouterse
ITng Services

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 28, 2010 19:03:36

M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Replace URLResolver?


Maybe, but it would be nice to unplug it and plug in your own.

/Martin

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Dec. 28, 2010 21:04:40

r.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Replace URLResolver?


I'm also curious how to resolve this problem. I'm planing to start small
site, where each user has his own subdomain (profile site).
How to construct urls in that situation:)

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Dec. 29, 2010 01:37:36

Sam L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Replace URLResolver?


On 28 December 2010 22:43, Martin <martins...@gmail.com> wrote:
> Hi.
>
> I would like to use subdomains in my URL-dispatch. Thats not supported
> by Django.
>
> Is it possible to replace Django URLResolver with my own? Must this be
> done as a Middleware class?

No, you can't really replace the default URLResolver without changing
any code in Django - lines 100-101 in django/core/handlers/base.py
(http://code.djangoproject.com/browser/django/trunk/django/core/handlers/base.py).
And even if you did, you would only be given the path_info of the
request, not the entire request object itself.

Your only option is middleware.

> (Why is Django URL resolver not implemented as a Middleware class?)

Besides what Brian said, it is probably for the same reason why regex
is the only way to specify URLs - there wasn't a need for anything
else when it was first designed, and given the current solution works
for nearly all cases, there have been minimal attempts to change it.

At some point, I'm considering rewriting the entire URL
resolution/reversal system to make it more modular, and submitting it
as a patch. (I bumped up against another limitation of it and had to
hack around it by changing Django code.) Don't hold your breath for
inclusion in a Django release any time soon though; as such a critical
part of Django, it'll probably be a while before it makes it into
trunk.

> Input appreciated.
>
> Thanks.
>
> /Martin
>
> --
> 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.
>
>

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 23rd of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support