finding domain name
bruno.42.desthuilliers at websiteburo.invalid
Wed Sep 24 09:13:52 CEST 2008
Bobby Roberts a écrit :
> On Sep 23, 1:23 pm, Bruno Desthuilliers
> <bdesth.quelquech... at free.quelquepart.fr> wrote:
>> Bobby Roberts a écrit :
>>> hi group. I'm new to python and need some help and hope you can
>>> answer this question. I have a situation in my code where i need to
>>> create a file on the server and write to it. That's not a problem if
>>> i hard code the path. However, the domain name needs to be dynamic so
>>> it is picked up automatically. The path to our websites is
>>> where xxxxx represents the domain name.
>>> How can I find the domain name of the current url being viewed.
>> What are you using exactly ? cgi ? wsgi ? Else ?
> mod python
Ok. So the informations you're looking for should be accessible as
attributes of the request object that get passed to your request
handler. Attributes of interest here are mostly request.hostname,
request.uri, request.path_info and request.filename. More informations here:
> over an in-house framework written years ago
Mmm... Then you might want to checkout which version of mod_python
you're using, and make sure you read the corresponding doc...
FWIW, there's also a mod_python mailing-list, so I suggest you seek
further assistance wrt/ mod_python specific stuff there. Of course,
questions about the Python language and it's standard lib are welcome here.
use the code, young jedi !-)
> so it's not the easiest thing to navigate. We will be
> moving to django this fall.
More information about the Python-list