Commit 3aa87ac0 authored by Stratos Psomadakis's avatar Stratos Psomadakis

snf-stats-app: Add support for configurable URLs

parent a40fcc09
## -*- coding: utf-8 -*-
##
## Top-level URL for deployment.
#STATS_BASE_URL = "https://host:port/stats"
#
## Image properties
#IMAGE_WIDTH = 210
#WIDTH = 68
......
......@@ -58,6 +58,7 @@ INSTALL_REQUIRES = [
'gdmodule',
'py-rrdtool',
'Django>=1.2, <1.3',
'snf-django-lib',
]
setup(
......
from django.conf import settings
from synnefo.lib import parse_base_url
BASE_URL = getattr(settings, 'STATS_BASE_URL',
'https://stats.example.synnefo.org/stats/')
BASE_HOST, BASE_PATH = parse_base_url(BASE_URL)
......@@ -31,9 +31,15 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
from django.conf.urls.defaults import patterns
from django.conf.urls.defaults import patterns, include
from snf_django.lib.api.utils import prefix_pattern
from synnefo_stats.stats_settings import BASE_PATH
from synnefo_stats.grapher import grapher
stats_patterns = patterns('',
(r'^(?P<hostname>\S+)/(?P<graph_type>\S+)/$', grapher),
)
urlpatterns = patterns('',
(r'^stats/(?P<hostname>\S+)/(?P<graph_type>\S+)/$', grapher),
(prefix_pattern(BASE_PATH), include(stats_patterns)),
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment