Commit 060646dda5513746393e4f8bd969df6cdebd9bb4
Committed by
Sergio Oliveira
1 parent
8e6958e0
Exists in
master
and in
39 other branches
Add homepage redirect configuration
-COLAB_HOME_URL in settings.py sets the homepage redirect, empty to ignore configuration Signed-off-by: Gustavo Jaruga Cruz <darksshades@gmail.com>
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
colab/settings.py
colab/urls.py
| ... | ... | @@ -2,6 +2,7 @@ from django.conf.urls import patterns, include, url, static |
| 2 | 2 | from django.conf import settings |
| 3 | 3 | from django.views.generic import TemplateView |
| 4 | 4 | from django.contrib import admin |
| 5 | +from django.views.generic import RedirectView | |
| 5 | 6 | |
| 6 | 7 | from .accounts.models import User |
| 7 | 8 | from .search.forms import ColabSearchForm |
| ... | ... | @@ -11,7 +12,6 @@ from .super_archives.models import Message |
| 11 | 12 | admin.autodiscover() |
| 12 | 13 | |
| 13 | 14 | urlpatterns = patterns('', |
| 14 | - url(r'^$', 'colab.home.views.index', name='home'), | |
| 15 | 15 | url(r'^robots.txt$', 'colab.home.views.robots', name='robots'), |
| 16 | 16 | |
| 17 | 17 | url(r'^open-data/$', TemplateView.as_view(template_name='open-data.html'), |
| ... | ... | @@ -45,3 +45,12 @@ if settings.DEBUG: |
| 45 | 45 | settings.MEDIA_URL, |
| 46 | 46 | document_root=settings.MEDIA_ROOT |
| 47 | 47 | ) |
| 48 | + | |
| 49 | +if settings.COLAB_HOME_URL: | |
| 50 | + urlpatterns += patterns('', | |
| 51 | + url(r'^$', RedirectView.as_view(url=settings.COLAB_HOME_URL), name='home'), | |
| 52 | + ) | |
| 53 | +else: | |
| 54 | + urlpatterns += patterns('', | |
| 55 | + url(r'^$', 'colab.home.views.index', name='home'), | |
| 56 | + ) | |
| 48 | 57 | \ No newline at end of file | ... | ... |