Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/red-azucar.py
diff options
context:
space:
mode:
authorSebastian Silva <sebastian@somosazucar.org>2013-11-19 09:22:02 (GMT)
committer Sebastian Silva <sebastian@somosazucar.org>2013-11-19 09:22:02 (GMT)
commited544cecc6ba9c3e7a70d331ad45c8646aa97e7f (patch)
treee5fe2683542fdd573271426b28fac3dd8f415abb /red-azucar.py
parentce809f48f405475deebf007030e6defed5bd293e (diff)
Try to decouple webui
Diffstat (limited to 'red-azucar.py')
-rwxr-xr-xred-azucar.py87
1 files changed, 0 insertions, 87 deletions
diff --git a/red-azucar.py b/red-azucar.py
deleted file mode 100755
index 3a03b57..0000000
--- a/red-azucar.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2012, Aleksey Lim
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import sys
-import optparse
-from os.path import dirname, join, realpath
-from gettext import gettext as _
-
-from gevent.wsgi import WSGIServer
-from sugar_network import sugar
-
-
-SRC_ROOT = dirname(realpath(__file__))
-
-
-host = optparse.Option(
- _('address to listen for Web clients'),
- default='127.0.0.1')
-
-port = optparse.Option(
- _('address to listen for Web clients'),
- default=5000)
-
-
-class Application(application.Daemon):
-
- httpd = None
-
- def start(self):
- application.logdir.value = sugar.profile_path('logs')
- application.rundir.value = sugar.profile_path('run')
- application.Daemon.start(self)
-
- def run(self):
- app = self._get_app()
- self.httpd = WSGIServer((host.value, port.value), app)
- self.httpd.serve_forever()
-
- def shutdown(self):
- if self.httpd is not None:
- self.httpd.stop()
-
- @application.command(_('Run application in debug mode'))
- def debug(self):
- app = self._get_app()
- app.debug = True
- app.run(host=host.value, port=port.value)
-
- def _get_app(self):
- try:
- from mejorar_sistema.app import app
- except ImportError:
- # Reuse from sources diretory
- sys.path.insert(0, join(SRC_ROOT, 'app'))
- from app import app
- return app
-
-
-optparse.Option.seek('mejorar-sistema')
-optparse.Option.seek('mejorar-sistema',
- [application.debug, application.foreground])
-
-app = Application(
- name='mejorar-sistema',
- description=_('Flask server to serve Sugar Network users'),
- epilog=_('See http://wiki.sugarlabs.org/go/Platform_Team/' \
- 'Sugar_Network/Browser.'),
- config_files=[
- '/etc/sweets.conf',
- '~/.config/sweets/config',
- sugar.profile_path('sweets.conf'),
- ])
-app.start()