Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions coldfront/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
ColdFront URL Configuration
"""

import environ
import split_settings
from django.conf import settings
from django.contrib import admin
from django.core import serializers
Expand All @@ -14,6 +16,7 @@
from django.views.generic import TemplateView

import coldfront.core.portal.views as portal_views
from coldfront.config.env import ENV, PROJECT_ROOT

admin.site.site_header = "ColdFront Administration"
admin.site.site_title = "ColdFront Administration"
Expand Down Expand Up @@ -60,3 +63,20 @@ def export_as_json(modeladmin, request, queryset):


admin.site.add_action(export_as_json, "export_as_json")

# Local urls overrides
local_urls = [
# Local urls relative to coldfront.config package
"local_urls.py",
# System wide urls for production deployments
"/etc/coldfront/local_urls.py",
# Local urls relative to coldfront project root
PROJECT_ROOT("local_urls.py"),
]

if ENV.str("COLDFRONT_URLS", default="") != "":
# Local urls from path specified via environment variable
local_urls.append(environ.Path(ENV.str("COLDFRONT_URLS"))())

for lu in local_urls:
split_settings.tools.include(split_settings.tools.optional(lu))
13 changes: 13 additions & 0 deletions docs/pages/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ You can also specify the path to `local_settings.py` using the
COLDFRONT_CONFIG=/opt/coldfront/mysettings.py
```

For [URL configurations](https://docs.djangoproject.com/en/dev/topics/http/urls/), you can create a python file to override ColdFront URLs:

- `local_urls.py` relative to coldfront.config package
- `/etc/coldfront/local_urls.py`
- `local_urls.py` in the ColdFront project root

You can also specify the path to `local_urls.py` using the
`COLDFRONT_URLS` environment variable. For example:

```
COLDFRONT_URLS=/opt/coldfront/myurls.py
```

## Simple Example

Here's a very simple example demonstrating how to configure ColdFront using
Expand Down