Self hosted FLOSS fitness/workout, nutrition and weight tracker
Move 'start_browser' to utils file
Roland Geider0fd8ae203f06
diff --git a/tasks.py b/tasks.pyindex 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 timeimport base64import inspect-import threading-import webbrowser--from invoke import run, task+import os+from invoke import taskfrom 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()--@taskdef migrate_db():'''diff --git a/wger/utils/main.py b/wger/utils/main.pyindex 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 loggingimport sys+import time+import logging+import threading+import webbrowserimport osimport ctypesimport 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()