source: osmose-frontend/osmose.py @ 1054d21

Last change on this file since 1054d21 was 1054d21, checked in by Frédéric Rodrigo <frodrigo@…>, 7 years ago

Switch to graph to matplotlib

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4#
5# Copyright 2012 Frederic Rodrigo
6#
7#
8
9import bottle
10from bottle import route, view, template, error
11
12from tools import utils
13
14app = bottle.default_app()
15
16from bottle import SimpleTemplate
17SimpleTemplate.defaults["get_url"] = app.get_url
18
19import bottle_pgsql_pool
20app.install(bottle_pgsql_pool.Plugin("host='localhost' dbname='%s' user='%s' password='%s'" % (utils.pg_base, utils.pg_user, utils.pg_pass), dictrows=False))
21import bottle_gettext, os
22app.install(bottle_gettext.Plugin('osmose-frontend', os.path.join("po", "mo"), utils.allowed_languages))
23
24def ext_filter(config):
25    regexp = r'html|json|xml|rss|png|svg|pdf'
26    def to_python(match):
27        return match if match in ('html', 'json', 'xml', 'rss', 'png', 'svg', 'pdf') else 'html'
28    def to_url(ext):
29        return ext
30    return regexp, to_python, to_url
31app.router.add_filter('ext', ext_filter)
32
33@route('/', name='root')
34@view('index')
35def index():
36    return {}
37
38@route('/copyright')
39@view('copyright')
40def copyright(name=None):
41    return {}
42
43@error(404)
44@view('404')
45def error404(error):
46    return {}
47
48import api_0_1
49import byuser
50import control
51import error
52import errors
53import map
54
55@route('/<filename:path>', name='static')
56def static(filename):
57    return bottle.static_file(filename, root='static')
Note: See TracBrowser for help on using the repository browser.