Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add --no-browser option

Roland Geideraadddf092e49
diff --git a/README.rst b/README.rst
index b2e274d30..d823bc2aa 100644
--- a/README.rst
+++ b/README.rst
@@ -96,6 +96,7 @@ The available options for the ``wger`` command (if installed from PyPI) or
-s SETTINGS, --settings=SETTINGS
Path to the wger configuration file.
--no-reload Do not reload the development server.
+ --no-browser Do not open the application in a browser.
--version Show version and exit.
--show-config Show configuration paths and exit.
diff --git a/docs/install.rst b/docs/install.rst
index 93b7795bd..9978f20e2 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -131,9 +131,9 @@ Edit your ``settings.py`` file and set the database, ``SITE_URL``,
>>> MEDIA_ROOT = '/home/myuser/wger/media'
Run the installation scritpt, this will load all initial data (exit after it
-is done and tries to start a web browser)::
+is done)::
- python start.py
+ python start.py --no-browser
Start.py will create a default administator user (you probably want to change
@@ -156,4 +156,4 @@ If you want to use the application as a public instance, you will probably want
change the following templates:
* **tos.html**, for your own Terms Of Service here
-* **about.html**, for your contact address or other such legal requirements
\ No newline at end of file
+* **about.html**, for your contact address or other such legal requirements
diff --git a/wger/main.py b/wger/main.py
index c04d9bc47..c8c9ce91e 100755
--- a/wger/main.py
+++ b/wger/main.py
@@ -108,6 +108,9 @@ def process_options(argv=None):
parser.add_option(
"--no-reload", action="store_true",
help="Do not reload the development server.")
+ parser.add_option(
+ "--no-browser", action="store_true",
+ help="Do not open the application in a browser.")
parser.add_option(
"--migrate-db", action="store_true",
help="Runs all database migrations (safe operation).")
@@ -171,12 +174,16 @@ def _main(opts, database_path=None):
if settings_path is None:
settings_path = get_user_config_path('wger', 'settings.py')
- # Find url to wger
+ # Override URL if no browser should be started
addr, port = detect_listen_opts(opts.address, opts.port)
- if port == 80:
- url = "http://{0}".format(addr)
+ if opts.no_browser:
+ url = None
else:
- url = "http://{0}:{1}".format(addr, port)
+ # Find url to wger
+ if port == 80:
+ url = "http://{0}".format(addr)
+ else:
+ url = "http://{0}:{1}".format(addr, port)
# Create settings if necessary
if not os.path.exists(settings_path):
@@ -203,6 +210,7 @@ def _main(opts, database_path=None):
extra_args = ['--noreload']
else:
extra_args = []
+
start_wger(addr, port, start_browser_url=url, extra_args=extra_args)