Dynamic SITE_ID (again)

161 views
Skip to first unread message

Joey Wilhelm

unread,
Nov 5, 2008, 10:20:20 AM11/5/08
to Django developers
I would like to bring up the topic discussed both in this ticket:
http://code.djangoproject.com/ticket/4438 and here in this group as
well: http://groups.google.com/group/django-developers/browse_thread/thread/4125cb192c72ed59/7a9f379f5e5b9090

I also found a snippet which implements something similar, here:
http://www.djangosnippets.org/snippets/1099/
Of course, the snippet didn't really work right and had to be beaten
into submission to even give the illusion of working.

Obviously, as discussed previously, none of these options are optimal.
They all have their fair share of issues, and there really should be a
better way to go about it.

Two of these options were mentioned by Malcolm in the aforementioned
thread; thread-local settings, or a more dynamic site object.

I found it odd that this discussion fell flat after a very short
period, over a year ago. Personally, this was a feature which I
initially assumed Django supported, simply because it seemed like such
an obvious one to me. Now I find myself struggling to get a project
working how I want due to the lack of what, in my mind, should be a
readily available feature.

Now I know from reading all of the previous discussions that this
really isn't such an easy implementation, but given the state of
Django today, how much work would really be involved? For that matter,
what design direction would be the preferred one?

Joe

unread,
Nov 6, 2008, 12:16:40 PM11/6/08
to django-d...@googlegroups.com
Joey Wilhelm wrote:
> I also found a snippet which implements something similar, here:
> http://www.djangosnippets.org/snippets/1099/
> Of course, the snippet didn't really work right and had to be beaten
> into submission to even give the illusion of working.

I also referred to that snippet for a solution to the Dynamice SITE_ID
problem. Was this the only problem you had:

http://www.djangosnippets.org/snippets/1099/#c1442

or did you run into other problems? Were you able to solve that one?

So far, it seems to work OK for me. I haven't used CurrentSiteManager()
yet though.

Joey Wilhelm

unread,
Nov 6, 2008, 12:43:05 PM11/6/08
to django-d...@googlegroups.com
Yes, I did run into that issue. This is what I ended up with: http://dpaste.com/89143/

Now I'm not saying that my code is 100% working, or that I recommend using it; that's why it's up on dpaste and not DjangoSnippets. Personally, I hate this solution.... but it at least seems to be working for now. I haven't had too much chance to do extensive testing yet though. Also, as has been pointed out in the past, this is simply -not- the right way to do it.

Fabien

unread,
Nov 7, 2008, 5:24:09 AM11/7/08
to django-d...@googlegroups.com
Hello,

> Now I know from reading all of the previous discussions that this
> really isn't such an easy implementation, but given the state of
> Django today, how much work would really be involved? For that matter,
> what design direction would be the preferred one?

I'm also interested by this "pony", so if a design decision is made, I
can try to write a patch or to improve an existing one.

--
Fabien SCHWOB

Reply all
Reply to author
Forward
0 new messages