예제 #1
0
def main():
    webapp = Main(debug=False)

    bind_address = "0.0.0.0"
    app_port = 80

    webapp = wsgiserver.CherryPyWSGIServer((bind_address, app_port), webapp)

    t = Thread(target=webapp.start)
    t.daemon = True
    t.start()

    try:
        while True:
            # Do nothing
            time.sleep(10000)
    except KeyboardInterrupt:
        webapp.stop()
예제 #2
0
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import env
import time
import wsgiserver

from app.wsgiapp import Main, Redirecter
from app.collector import collect_mactraffic

from threading import Thread

webapp = Main(debug=False)
redirecter = Redirecter(debug=False)

bind_address = "0.0.0.0"
redirecter_port = 80
app_port = 5000

webapp = wsgiserver.CherryPyWSGIServer((bind_address, app_port), webapp)
redirecter = wsgiserver.CherryPyWSGIServer((bind_address, redirecter_port),
                                           redirecter)

for target in (webapp, redirecter):
    t = Thread(target=target.start)
    t.daemon = True
    t.start()

collect_mactraffic()

try:
    while True: