Skip to content

Commit

Permalink
Merge pull request ome#123 from manics/override-root-app
Browse files Browse the repository at this point in the history
omero.web.root_application: override / handler
  • Loading branch information
joshmoore authored Mar 3, 2020
2 parents 810df9f + dc25d8e commit ea8adfd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions omeroweb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,15 @@ def leave_none_unset_int(s):
json.loads,
("Add additional Django applications. For example, see"
" :doc:`/developers/Web/CreateApp`")],
"omero.web.root_application":
["OMEROWEB_ROOT_APPLICATION",
'',
str,
("Override the root application label that handles ``/``. "
"**Warning** you must ensure the application's URLs do not conflict "
"with other applications. "
"omero-gallery is an example of an application that can be used for "
"this (set to ``gallery``)")],
"omero.web.databases":
["DATABASES", '{}', json.loads, None],
"omero.web.page_size":
Expand Down
6 changes: 5 additions & 1 deletion omeroweb/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ def redirect_urlpatterns():
if urls_found is not None:
try:
__import__(urlmodule)
regex = '^(?i)%s/' % label
# https://stackoverflow.com/questions/7580220/django-urls-how-to-map-root-to-app
if label == settings.OMEROWEB_ROOT_APPLICATION:
regex = r'^'
else:
regex = '^(?i)%s/' % label
urlpatterns.append(url(regex, include(urlmodule)))
except ImportError:
print("""Failed to import %s
Expand Down

0 comments on commit ea8adfd

Please sign in to comment.