Commits

David Larlet committed 07c86fe

Separate the browser from the launcher, more clean

Comments (0)

Files changed (4)

 
 Launch the python script:
 
-    $ python src/browser.py
+    $ python src/launcher.py
     INFO:werkzeug: * Running on http://127.0.0.1:5000/
 
 Go to the running URL and enjoy a clutter free browsing experience!

Empty file added.

 from werkzeug.utils import redirect
 from werkzeug.routing import Map, Rule
 from werkzeug.exceptions import HTTPException
-from werkzeug.wsgi import SharedDataMiddleware
 from werkzeug.wrappers import Request, Response
 from werkzeug.urls import url_quote_plus, url_unquote_plus
 from jinja2 import Environment, FileSystemLoader
 from whoosh.highlight import ContextFragmenter
 
 from storage import Storage
-from settings import (
-    LOCAL_HOST, LOCAL_PORT, PROXY_URL,
-    CSS_THEME, USE_DEBUGGER, USE_RELOADER
-)
+from settings import PROXY_URL, CSS_THEME
 from utils import get_hostname, highlights, is_valid_url
 
 
 
 
 if __name__ == '__main__':
-    from werkzeug.serving import run_simple
-    app = Browser()
-    app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {
-        '/static':  os.path.join(os.path.dirname(__file__), 'static')
-    })
-    run_simple(LOCAL_HOST, LOCAL_PORT, app,
-               use_debugger=USE_DEBUGGER, use_reloader=USE_RELOADER)
+    print "BACKWARD INCOMPATIBILITY: You need to run `python src/launch.py` now."
+# -*- coding: utf-8 -*-
+import os
+
+from werkzeug.serving import run_simple
+from werkzeug.wsgi import SharedDataMiddleware
+
+from browser import Browser
+from settings import LOCAL_HOST, LOCAL_PORT, USE_DEBUGGER, USE_RELOADER
+
+
+app = Browser()
+app.wsgi_app = SharedDataMiddleware(app.wsgi_app, {
+    '/static':  os.path.join(os.path.dirname(__file__), 'static')
+})
+run_simple(LOCAL_HOST, LOCAL_PORT, app,
+           use_debugger=USE_DEBUGGER, use_reloader=USE_RELOADER)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.