From 363852973b549e843569f3ed74896c19f2b422d8 Mon Sep 17 00:00:00 2001 From: Tiberiu Chibici Date: Sun, 18 Oct 2020 15:54:03 +0300 Subject: [PATCH 1/2] Fix migration error which happens on first migrate, when dynamic-preferences models aren't yet created. --- app/YtManagerApp/migrations/0014_fix_video_provider.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/YtManagerApp/migrations/0014_fix_video_provider.py b/app/YtManagerApp/migrations/0014_fix_video_provider.py index da0a359..ffa7472 100644 --- a/app/YtManagerApp/migrations/0014_fix_video_provider.py +++ b/app/YtManagerApp/migrations/0014_fix_video_provider.py @@ -5,7 +5,12 @@ import json def fix_video_provider(apps, schema_editor): - globalPrefs = apps.get_model('dynamic_preferences', 'GlobalPreferenceModel') + try: + globalPrefs = apps.get_model('dynamic_preferences', 'GlobalPreferenceModel') + except LookupError as e: + print("Warning: could not get dynamic_preferences model.") + return + api_key_entries = globalPrefs.objects.filter(name='youtube_api_key') if len(api_key_entries) < 1: return From d7234b6c6d969986e667c9c3ba0615a55265ea72 Mon Sep 17 00:00:00 2001 From: Tiberiu Chibici Date: Sun, 18 Oct 2020 15:54:21 +0300 Subject: [PATCH 2/2] Added convenience scripts for creating venv. --- make_venv.cmd | 16 ++++++++++++++++ manage.cmd | 2 ++ venv_cmd.cmd | 2 ++ 3 files changed, 20 insertions(+) create mode 100644 make_venv.cmd create mode 100644 manage.cmd create mode 100644 venv_cmd.cmd diff --git a/make_venv.cmd b/make_venv.cmd new file mode 100644 index 0000000..5aba19c --- /dev/null +++ b/make_venv.cmd @@ -0,0 +1,16 @@ +@echo off + +echo Installing venv... +python -m pip install virtualenv + +echo[ +echo Creating venv... +python -m venv venv +call venv\Scripts\activate.bat + +echo[ +echo Pulling dependencies... +pip install --upgrade pip +pip install -r requirements.txt + +pause \ No newline at end of file diff --git a/manage.cmd b/manage.cmd new file mode 100644 index 0000000..e79914f --- /dev/null +++ b/manage.cmd @@ -0,0 +1,2 @@ +@echo off +python %~dp0\app\manage.py %* \ No newline at end of file diff --git a/venv_cmd.cmd b/venv_cmd.cmd new file mode 100644 index 0000000..8fe528d --- /dev/null +++ b/venv_cmd.cmd @@ -0,0 +1,2 @@ +@set APP_PATH=%~dp0\app +@cmd /k "set PATH=%PATH%;%APP_PATH% && venv\Scripts\activate.bat \ No newline at end of file