In production, you would never rely on wsgi to serve static content. You
would use apache, preferably on a subdomain, to serve static content (unless
it is content that requires authentication)

I propose a function, that works like the URL function, but you could have a
global variable that defines your static url.

For example, in db.py (or perhaps settings.py in the models folder?)

static_server = "http://static.thadeusb.com/";
# or static_server = "localhost"

def S(filename):
    if static_server == "localhost":
        return URL(r=request, c='static', f=filename)
    else:
        return static_server + filename


And you can use it in your controllers/views like so

{{=S("images/spiffyimage.jpg")}}

This way will increase the ability for one-click deployment to production,
you only have to change one line!

-Thadeus

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to