Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/cedaMoles/MolesManager/__init__.py@8537
Line | |
---|
1 | import os |
---|
2 | def get_application_root_url(request): |
---|
3 | """ |
---|
4 | Returns a string reflecting the full URL relative to the actual deployment. |
---|
5 | Looks inside the os.environ dict a key named 'CEDA_MOLES_ROOT_URL'. |
---|
6 | If not found assumes the root path is '/' |
---|
7 | |
---|
8 | **PARAMETERS"" |
---|
9 | * `HTTPRequest` **request**: |
---|
10 | a django.HttpRequest |
---|
11 | """ |
---|
12 | root_url = '' |
---|
13 | if os.environ.has_key('CEDA_MOLES_ROOT_URL') \ |
---|
14 | and len(os.environ['CEDA_MOLES_ROOT_URL'].strip()) > 0: |
---|
15 | root_url = os.environ['CEDA_MOLES_ROOT_URL'] |
---|
16 | return 'http://%s/%s/' % (request.get_host(), root_url) |
---|
17 | |
---|
18 | return 'http://%s/' % request.get_host() |
---|
Note: See
TracBrowser
for help on using the repository browser.