示例#1
0
def initapp(root):
    hwserver = conf("hwserver", "addr")
    hwport = confInt("hwserver", "port")
    print "Hardware server %s:%s" % (hwserver, hwport)
    app = Application(master=root)
    concurrence.Tasklet.new(monitorHw)(app)
    return app
示例#2
0
def initapp(root):
    hwserver = conf("hwserver", "addr")
    hwport = confInt("hwserver", "port")
    print "Hardware server %s:%s" % (hwserver, hwport)
    app = Application(master=root)
    concurrence.Tasklet.new(monitorHw)(app)
    return app
示例#3
0
def monitor(request):
    if request.user.has_perm("api.monitor"):
        addr = conf("hwserver", "addr", "127.0.0.1")
        port = confInt("hwserver", "port", 8081)
        response_data = {"addr": addr, "port": port}
        # TODO: connect to backend
    else:
        response_data = {"err": "authfailed", "msg": "Not authorized"}
    return HttpResponse(json.dumps(response_data), mimetype="application/json")
示例#4
0
def main():
    try:
        setupLogging()
        server = WSGIServer(app_wrapper)
        addr = conf('web', 'addr', '0.0.0.0')
        port = confInt('web', 'port', 8080)
        server.serve((addr, port))
        logging.getLogger("hautowebsrv").info("Serving HTTP at %s:%s", addr, port)
        while True:
            Tasklet.sleep(1)
    except Exception as e:
        logging.exception(e)
        os._exit(1)
示例#5
0
def main():
    try:
        setupLogging()
        server = WSGIServer(app_wrapper)
        addr = conf('web', 'addr', '0.0.0.0')
        port = confInt('web', 'port', 8080)
        server.serve((addr, port))
        logging.getLogger("hautowebsrv").info("Serving HTTP at %s:%s", addr,
                                              port)
        while True:
            Tasklet.sleep(1)
    except Exception as e:
        logging.exception(e)
        os._exit(1)
示例#6
0
def monitor(request):
    if request.user.has_perm("api.monitor"):
        addr = conf("hwserver", "addr", "127.0.0.1")
        port = confInt("hwserver", "port", 8081)
        response_data = {
            "addr": addr,
            "port": port
        }
        # TODO: connect to backend
    else:
        response_data = {
            "err": "authfailed",
            "msg": "Not authorized"
        }
    return HttpResponse(json.dumps(response_data), mimetype="application/json")
示例#7
0
# Django settings for hautoweb project.

from hwserver.config import conf
import os
import re
path = os.path.abspath(re.sub(r'\/[^\/]+$', '', __file__))

DEBUG = True
TEMPLATE_DEBUG = DEBUG

adminName = conf("web", "adminName")
adminEmail = conf("web", "adminEmail")
if adminName and adminEmail:
    ADMINS = ((adminName, adminEmail), )
else:
    ADMINS = ()
MANAGERS = ADMINS
TIME_ZONE = None
LANGUAGE_CODE = conf("web", "language", 'en-us')
SITE_ID = 1
USE_I18N = True
USE_L10N = True
MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/'
SECRET_KEY = conf("web", "secretKey", 'nosecretkey')
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    #     'django.template.loaders.eggs.Loader',
)
示例#8
0
# Django settings for hautoweb project.

from hwserver.config import conf
import os
import re

path = os.path.abspath(re.sub(r"\/[^\/]+$", "", __file__))

DEBUG = True
TEMPLATE_DEBUG = DEBUG

adminName = conf("web", "adminName")
adminEmail = conf("web", "adminEmail")
if adminName and adminEmail:
    ADMINS = ((adminName, adminEmail),)
else:
    ADMINS = ()
MANAGERS = ADMINS
TIME_ZONE = None
LANGUAGE_CODE = conf("web", "language", "en-us")
SITE_ID = 1
USE_I18N = True
USE_L10N = True
MEDIA_ROOT = ""
MEDIA_URL = ""
ADMIN_MEDIA_PREFIX = "/media/"
SECRET_KEY = conf("web", "secretKey", "nosecretkey")
TEMPLATE_LOADERS = (
    "django.template.loaders.filesystem.Loader",
    "django.template.loaders.app_directories.Loader",
    #     'django.template.loaders.eggs.Loader',