I'd like to have a solution to this problem too.

My specific problem is that I have a bunch of sites in development on my laptop:

        http://localhost/coolsite/
        http://localhost/boringsite/
        http://localhost/newhomepage/

And these then get deployed to production servers:

        http://coolsite.com/
        http://boringsite/newcoolthing/
        http://homepage.org/

I solve it right now by adding a setting, URLBASE, and then doing circles to get it into everything, mainly with lots of extra_context stuff to push it through generic views into templates.

I'm aware this is sub-optimal.

One solution is to use the sites functionality - will Django bork if my site url is localhost/folder?

The other is to use a middleware or context processor to pull in URLBASE.

Ben


On 15 Jan 2006, at 4:17, Greg wrote:


Thanks for the advice guys. Amit, yeah I should have mentioned that I
totally agree that django shouldn't serve static files in a production
environment. And keeping a /static/ directory sounds like a pretty good
way to do that.

I started writing something more like Andy's #2 suggestion... a way to
abstract the media root so it doesn't have to be hardcoded all over my
templates. I made a tag to generate static URLs, and hacked the django
code in order to remember a template's application's settings like the
location of the media directory (if the template belongs to a
application, that is). It works really well but I imagine there are
various kinds of issues to consider for a facility like that. And
you're right Andy, it's not really a ideal solution unless all the apps
you're using use it. Well, it sounds like the dev team has their hands
full right now with more important things like magic-removal and 1.0,
but maybe I'll float this idea after that. Mostly I just wanted to make
sure I wasn't high or completely missing the point.



________________________________
Afternoon, man about the Internet -- http://aftnn.org/


Reply via email to