def server_command(args): repository = args.repository app.config.update(REPOSITORY=repository, SESSION_ID=args.session_id) app.debug = args.debug if args.no_worker: app.config.update(USE_WORKER=False) if args.profile: try: from linesman.middleware import make_linesman_middleware except ImportError: print( '-P/--profile/--linesman option is available only when ' "linesman is installed", file=sys.stderr) print('Try the following command:', file=sys.stderr) print('\tpip install linesman', file=sys.stderr) raise SystemExit else: print('Profiler (linesman) is available:', 'http://{0.host}:{0.port}/__profiler__/'.format(args)) app.wsgi_app = make_linesman_middleware(app.wsgi_app) if args.debug: app.wsgi_app = SassMiddleware( app.wsgi_app, {'earthreader.web': ('static/scss/', 'static/css/')}) app.run(host=args.host, port=args.port, debug=args.debug, threaded=True) else: serve(app, host=args.host, port=args.port)
def server_command(args): repository = args.repository app.config.update(REPOSITORY=repository, SESSION_ID=args.session_id) app.debug = args.debug if args.no_worker: app.config.update(USE_WORKER=False) if args.profile: try: from linesman.middleware import make_linesman_middleware except ImportError: print('-P/--profile/--linesman option is available only when ' "linesman is installed", file=sys.stderr) print('Try the following command:', file=sys.stderr) print('\tpip install linesman', file=sys.stderr) raise SystemExit else: print('Profiler (linesman) is available:', 'http://{0.host}:{0.port}/__profiler__/'.format(args)) app.wsgi_app = make_linesman_middleware(app.wsgi_app) if args.debug: app.wsgi_app = SassMiddleware(app.wsgi_app, { 'earthreader.web': ('static/scss/', 'static/css/') }) app.run(host=args.host, port=args.port, debug=args.debug, threaded=True) else: serve(app, host=args.host, port=args.port)
# -*- coding: utf-8 -*- import os import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'web.settings' from admin_dashboard.site import AdminSite from django.contrib import admin admin.site = AdminSite() import django.core.handlers.wsgi from linesman.middleware import make_linesman_middleware application = django.core.handlers.wsgi.WSGIHandler() application = make_linesman_middleware(application)