Skip to content

Commit

Permalink
Upgrade to Django 1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
frankh committed Mar 16, 2017
1 parent ed32dea commit b1bca09
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 73 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
master
------

* Upgrade to Django 1.10
* Upgrade to Celery 4

Version 0.9.2
Expand Down
123 changes: 51 additions & 72 deletions cabot/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import patterns, include, url
from django.conf.urls import include, url
from django.conf import settings
from cabot.cabotapp.views import (
about, run_status_check, graphite_api_data, checks_run_recently,
Expand Down Expand Up @@ -33,7 +33,6 @@

logger = logging.getLogger(__name__)


def first_time_setup_wrapper(func):
def wrapper(*args, **kwargs):
if cabot_needs_setup():
Expand All @@ -42,128 +41,108 @@ def wrapper(*args, **kwargs):
return func(*args, **kwargs)
return wrapper

urlpatterns = patterns('',
urlpatterns = [
# for the password reset views
url('^', include('django.contrib.auth.urls')),

url(r'^$', view=RedirectView.as_view(url='services/', permanent=False),
name='dashboard'),
name='dashboard'),
url(r'^subscriptions/', view=subscriptions,
name='subscriptions'),
name='subscriptions'),
url(r'^accounts/login/', view=first_time_setup_wrapper(login), name='login'),
url(r'^accounts/logout/', view=logout, name='logout'),
url(r'^setup/', view=SetupView.as_view(), name='first_time_setup'),
url(r'^accounts/password-reset/',
view=password_reset, name='password-reset'),
view=password_reset, name='password-reset'),
url(r'^accounts/password-reset-done/',
view=password_reset_done, name='password-reset-done'),
view=password_reset_done, name='password-reset-done'),
url(r'^accounts/password-reset-confirm/',
view=password_reset_confirm, name='password-reset-confirm'),
view=password_reset_confirm, name='password-reset-confirm'),
url(r'^status/', view=checks_run_recently,
name='system-status'),
name='system-status'),
url(r'^about/', view=about,
name='about-cabot'),

url(r'^services/', view=ServiceListView.as_view(),
name='services'),
name='services'),
url(r'^service/create/', view=ServiceCreateView.as_view(),
name='create-service'),
name='create-service'),
url(r'^service/update/(?P<pk>\d+)/',
view=ServiceUpdateView.as_view(
), name='update-service'),
view=ServiceUpdateView.as_view(), name='update-service'),
url(r'^service/delete/(?P<pk>\d+)/',
view=ServiceDeleteView.as_view(
), name='delete-service'),
view=ServiceDeleteView.as_view(), name='delete-service'),
url(r'^service/(?P<pk>\d+)/',
view=ServiceDetailView.as_view(), name='service'),
view=ServiceDetailView.as_view(), name='service'),
url(r'^service/acknowledge_alert/(?P<pk>\d+)/',
view=acknowledge_alert, name='acknowledge-alert'),
view=acknowledge_alert, name='acknowledge-alert'),
url(r'^service/remove_acknowledgement/(?P<pk>\d+)/',
view=remove_acknowledgement, name='remove-acknowledgement'),
view=remove_acknowledgement, name='remove-acknowledgement'),

url(r'^instances/', view=InstanceListView.as_view(),
name='instances'),
name='instances'),
url(r'^instance/create/', view=InstanceCreateView.as_view(),
name='create-instance'),
name='create-instance'),
url(r'^instance/update/(?P<pk>\d+)/',
view=InstanceUpdateView.as_view(
), name='update-instance'),
view=InstanceUpdateView.as_view(), name='update-instance'),
url(r'^instance/duplicate/(?P<pk>\d+)/',
view=duplicate_instance, name='duplicate-instance'),
view=duplicate_instance, name='duplicate-instance'),
url(r'^instance/delete/(?P<pk>\d+)/',
view=InstanceDeleteView.as_view(
), name='delete-instance'),
view=InstanceDeleteView.as_view(), name='delete-instance'),
url(r'^instance/(?P<pk>\d+)/',
view=InstanceDetailView.as_view(), name='instance'),
view=InstanceDetailView.as_view(), name='instance'),

url(r'^checks/$', view=StatusCheckListView.as_view(),
name='checks'),
name='checks'),
url(r'^check/run/(?P<pk>\d+)/',
view=run_status_check, name='run-check'),
view=run_status_check, name='run-check'),
url(r'^check/delete/(?P<pk>\d+)/',
view=StatusCheckDeleteView.as_view(
), name='delete-check'),
view=StatusCheckDeleteView.as_view(), name='delete-check'),
url(r'^check/(?P<pk>\d+)/',
view=StatusCheckDetailView.as_view(), name='check'),
view=StatusCheckDetailView.as_view(), name='check'),
url(r'^checks/report/$',
view=StatusCheckReportView.as_view(), name='checks-report'),

view=StatusCheckReportView.as_view(), name='checks-report'),

url(r'^icmpcheck/create/', view=ICMPCheckCreateView.as_view(),
name='create-icmp-check'),
name='create-icmp-check'),
url(r'^icmpcheck/update/(?P<pk>\d+)/',
view=ICMPCheckUpdateView.as_view(
), name='update-icmp-check'),
view=ICMPCheckUpdateView.as_view(), name='update-icmp-check'),
url(r'^icmpcheck/duplicate/(?P<pk>\d+)/',
view=duplicate_icmp_check, name='duplicate-icmp-check'),

view=duplicate_icmp_check, name='duplicate-icmp-check'),
url(r'^graphitecheck/create/',
view=GraphiteCheckCreateView.as_view(
), name='create-graphite-check'),
view=GraphiteCheckCreateView.as_view(), name='create-graphite-check'),
url(r'^graphitecheck/update/(?P<pk>\d+)/',
view=GraphiteCheckUpdateView.as_view(
), name='update-graphite-check'),
view=GraphiteCheckUpdateView.as_view(), name='update-graphite-check'),
url(r'^graphitecheck/duplicate/(?P<pk>\d+)/',
view=duplicate_graphite_check, name='duplicate-graphite-check'),

view=duplicate_graphite_check, name='duplicate-graphite-check'),
url(r'^httpcheck/create/', view=HttpCheckCreateView.as_view(),
name='create-http-check'),
name='create-http-check'),
url(r'^httpcheck/update/(?P<pk>\d+)/',
view=HttpCheckUpdateView.as_view(
), name='update-http-check'),
view=HttpCheckUpdateView.as_view(), name='update-http-check'),
url(r'^httpcheck/duplicate/(?P<pk>\d+)/',
view=duplicate_http_check, name='duplicate-http-check'),

view=duplicate_http_check, name='duplicate-http-check'),
url(r'^jenkins_check/create/', view=JenkinsCheckCreateView.as_view(),
name='create-jenkins-check'),
name='create-jenkins-check'),
url(r'^jenkins_check/update/(?P<pk>\d+)/',
view=JenkinsCheckUpdateView.as_view(
), name='update-jenkins-check'),
view=JenkinsCheckUpdateView.as_view(), name='update-jenkins-check'),
url(r'^jenkins_check/duplicate/(?P<pk>\d+)/',
view=duplicate_jenkins_check, name='duplicate-jenkins-check'),
url(r'^result/(?P<pk>\d+)/',
view=StatusCheckResultDetailView.as_view(
), name='result'),
view=duplicate_jenkins_check,
name='duplicate-jenkins-check'),

url(r'^result/(?P<pk>\d+)/',
view=StatusCheckResultDetailView.as_view(), name='result'),
url(r'^shifts/', view=ShiftListView.as_view(),
name='shifts'),

name='shifts'),
url(r'^graphite/', view=graphite_api_data,
name='graphite-data'),

name='graphite-data'),
url(r'^user/(?P<pk>\d+)/profile/$',
view=UserProfileUpdateView.as_view(), name='user-profile'),
view=UserProfileUpdateView.as_view(), name='user-profile'),
url(r'^user/(?P<pk>\d+)/profile/(?P<alerttype>.+)',
view=UserProfileUpdateAlert.as_view(
), name='update-alert-user-data'),

view=UserProfileUpdateAlert.as_view(), name='update-alert-user-data'),
url(r'^admin/', include(admin.site.urls)),

# Comment below line to disable browsable rest api
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),

url(r'^api/', include(rest_urls.router.urls)),
)
]

def append_plugin_urls():
"""
Expand All @@ -176,13 +155,13 @@ def append_plugin_urls():
except Exception as e:
pass
else:
urlpatterns += patterns('',
urlpatterns += [
url(r'^plugins/%s/' % plugin, include('%s.urls' % plugin))
)
]

append_plugin_urls()

if settings.URL_PREFIX.strip('/'):
urlpatterns = patterns('',
('^%s/' % settings.URL_PREFIX.strip('/'), include(urlpatterns))
)
urlpatterns = [
url(r'^%s/' % settings.URL_PREFIX.strip('/'), include(urlpatterns))
]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ django-filter==1.0.1
django-jsonify==0.3.0
django-mptt==0.6.0
django-polymorphic==1.1
Django>=1.9,<1.10
Django>=1.10,<1.11
djangorestframework>=3.5,<3.6
freezegun==0.3.8
gevent==1.0.1
Expand Down

0 comments on commit b1bca09

Please sign in to comment.