Esempio n. 1
0
 def execute(self):
     from __main__ import APP_MODULE, APP_DIR, SCRIPT_DIR, PUBLIC_DIR
     app = load_definition_from_string(
         '{0}.app.application'.format(APP_MODULE))
     os.chdir(APP_DIR)
     make_dev_server(app,
                     do_reload=True,
                     script_dir=SCRIPT_DIR,
                     public_dir=PUBLIC_DIR)
# -*- coding: utf-8 -*-
# Runs an extremely simple web application on the development server
# and auto-reloads on change.
import os
import sys
from wsgiref.util import setup_testing_defaults

sys.path.append(os.path.abspath(".."))
from watson.http.messages import Response, create_request_from_environ
from watson.util.server import make_dev_server


def simple_request_response(environ, start_response):
    setup_testing_defaults(environ)

    request = create_request_from_environ(environ)
    response = Response(200, body="Hello World!")

    start_response(*response.start())
    return [response()]


if __name__ == "__main__":
    make_dev_server(simple_request_response, do_reload=True)
Esempio n. 3
0
# -*- coding: utf-8 -*-
# Runs an extremely simple web application on the development server
# and auto-reloads on change.
# This can either be run via `python app.py` or through uWSGI.
import os
import sys
try:
    import watson
except:
    sys.path.append(os.path.abspath('../../..'))
from watson.mvc import applications
from watson.util.server import make_dev_server
from config import local

application = applications.Http(local)

if __name__ == '__main__':
    make_dev_server(application, do_reload=True)
Esempio n. 4
0
 def execute(self):
     from __main__ import APP_MODULE, APP_DIR, SCRIPT_DIR, PUBLIC_DIR
     app = load_definition_from_string('{0}.app.application'.format(APP_MODULE))
     os.chdir(APP_DIR)
     make_dev_server(app, do_reload=True, script_dir=SCRIPT_DIR, public_dir=PUBLIC_DIR)
Esempio n. 5
0
# -*- coding: utf-8 -*-
# Runs an extremely simple web application on the development server
# and auto-reloads on change.
import os
import sys
from wsgiref.util import setup_testing_defaults

sys.path.append(os.path.abspath('..'))
from watson.http.messages import Response, create_request_from_environ
from watson.util.server import make_dev_server


def simple_request_response(environ, start_response):
    setup_testing_defaults(environ)

    request = create_request_from_environ(environ)
    response = Response(200, body='Hello World!')

    start_response(*response.start())
    return [response()]


if __name__ == '__main__':
    make_dev_server(simple_request_response, do_reload=True)