Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Move 'start_browser' to utils file

Roland Geider0fd8ae203f06
diff --git a/tasks.py b/tasks.py
index d0ce3d835..a10da050c 100644
--- a/tasks.py
+++ b/tasks.py
@@ -14,15 +14,11 @@
#
# You should have received a copy of the GNU Affero General Public License
-import os
-import time
import base64
import inspect
-import threading
-import webbrowser
-
-from invoke import run, task
+import os
+from invoke import task
from django.core.management import (
call_command,
execute_from_command_line
@@ -33,7 +29,8 @@ from wger.utils.main import (
get_user_config_path,
detect_listen_opts,
setup_django_environment,
- database_exists
+ database_exists,
+ start_browser
)
@@ -185,21 +182,6 @@ def create_or_reset_admin():
call_command("loaddata", path + "users.json")
-@task
-def start_browser(url):
- '''
- Start the web browser with the given URL
- '''
- browser = webbrowser.get()
-
- def function():
- time.sleep(1)
- browser.open(url)
-
- thread = threading.Thread(target=function)
- thread.start()
-
-
@task
def migrate_db():
'''
diff --git a/wger/utils/main.py b/wger/utils/main.py
index 6571be69e..8c9078ecf 100644
--- a/wger/utils/main.py
+++ b/wger/utils/main.py
@@ -12,8 +12,11 @@
#
# You should have received a copy of the GNU Affero General Public License
-import logging
import sys
+import time
+import logging
+import threading
+import webbrowser
import os
import ctypes
import socket
@@ -116,3 +119,17 @@ def database_exists():
sys.exit(0)
else:
return True
+
+
+def start_browser(url):
+ '''
+ Start the web browser with the given URL
+ '''
+ browser = webbrowser.get()
+
+ def function():
+ time.sleep(1)
+ browser.open(url)
+
+ thread = threading.Thread(target=function)
+ thread.start()