From 4ec9140c981f77e6e546856e316a2604ce7fe3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzikowski?= Date: Fri, 27 Aug 2021 16:32:22 +0200 Subject: [PATCH 1/8] Bump all versions in requirements.txt --- requirements.txt | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/requirements.txt b/requirements.txt index 714e5a6a2..a45f1da52 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,32 +1,32 @@ -arrow==0.13.1 -bibtexparser==1.1.0 -blessed==1.15.0 -chardet==3.0.4 -Django==2.2.24 -django-crispy-forms==1.7.2 +Django==3.2.6 +Faker==8.12.1 +arrow==1.1.1 +bibtexparser==1.2.0 +blessed==1.18.1 +chardet==4.0.0 +django-crispy-forms==1.12.0 django-environ==0.4.5 -django-model-utils==3.1.2 -django-picklefield==2.0 -django-q==1.0.1 +django-model-utils==4.1.1 +django-picklefield==3.0.1 +django-q==1.3.9 django-settings-export==1.2.1 -django-simple-history==2.7.2 -django-split-settings==1.0.1 -django-sslserver==0.20 -django-su==0.8.0 -doi2bib==0.3.0 -factory-boy==2.12.0 -Faker==3.0.0 -future==0.17.1 -humanize==0.5.1 -idna==2.8 -pyparsing==2.3.1 -python-dateutil==2.8.0 +django-simple-history==3.0.0 +django-split-settings==1.1.0 +django-sslserver==0.22 +django-su==0.9.0 +doi2bib==0.4.0 +factory-boy==3.2.0 +future==0.18.2 +humanize==3.11.0 +idna==3.2 +pyparsing==2.4.7 +python-dateutil==2.8.2 python-memcached==1.59 -pytz==2018.9 -redis==3.2.1 +pytz==2021.1 +redis==3.5.3 requests==2.26.0 -six==1.12.0 -sqlparse==0.3.0 +six==1.16.0 +sqlparse==0.4.1 text-unidecode==1.3 urllib3==1.26.6 -wcwidth==0.1.7 +wcwidth==0.2.5 From 9792e853bf601692ef0b6acf79645f88c2f7da90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzikowski?= Date: Fri, 27 Aug 2021 16:33:46 +0200 Subject: [PATCH 2/8] psycog2 model in django in deprecated --- coldfront/config/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coldfront/config/database.py b/coldfront/config/database.py index 02ef12065..13fcd8c7a 100644 --- a/coldfront/config/database.py +++ b/coldfront/config/database.py @@ -44,7 +44,7 @@ # # DATABASES = { # 'default': { -# 'ENGINE': 'django.db.backends.postgresql_psycopg2', +# 'ENGINE': 'django.db.backends.postgresql', # 'NAME': 'coldfront', # 'USER': '', # 'PASSWORD': '', From 8e3078eb9d79191c44c5d3f1768e94b16515f068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzikowski?= Date: Fri, 27 Aug 2021 16:33:59 +0200 Subject: [PATCH 3/8] Add name = 'allocation' name = 'coldfront.core.allocation' it rises error otherwise --- coldfront/core/allocation/apps.py | 2 +- coldfront/core/grant/apps.py | 2 +- coldfront/core/portal/apps.py | 2 +- coldfront/core/publication/apps.py | 2 +- coldfront/core/research_output/apps.py | 2 +- coldfront/core/resource/apps.py | 2 +- coldfront/core/utils/apps.py | 3 ++- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/coldfront/core/allocation/apps.py b/coldfront/core/allocation/apps.py index cabee3815..ba463b89e 100644 --- a/coldfront/core/allocation/apps.py +++ b/coldfront/core/allocation/apps.py @@ -2,4 +2,4 @@ class AllocationConfig(AppConfig): - name = 'allocation' + name = 'coldfront.core.allocation' diff --git a/coldfront/core/grant/apps.py b/coldfront/core/grant/apps.py index 466cd0154..6e10b638a 100644 --- a/coldfront/core/grant/apps.py +++ b/coldfront/core/grant/apps.py @@ -2,4 +2,4 @@ class GrantConfig(AppConfig): - name = 'grant' + name = 'coldfront.core.grant' diff --git a/coldfront/core/portal/apps.py b/coldfront/core/portal/apps.py index 811caa82b..988452e2a 100644 --- a/coldfront/core/portal/apps.py +++ b/coldfront/core/portal/apps.py @@ -2,4 +2,4 @@ class PortalConfig(AppConfig): - name = 'portal' + name = 'coldfront.core.portal' diff --git a/coldfront/core/publication/apps.py b/coldfront/core/publication/apps.py index 822ed8f7a..aafa0bf63 100644 --- a/coldfront/core/publication/apps.py +++ b/coldfront/core/publication/apps.py @@ -2,4 +2,4 @@ class PublicationConfig(AppConfig): - name = 'publication' + name = 'coldfront.core.publication' diff --git a/coldfront/core/research_output/apps.py b/coldfront/core/research_output/apps.py index b4651b9f2..2b02d013a 100644 --- a/coldfront/core/research_output/apps.py +++ b/coldfront/core/research_output/apps.py @@ -2,4 +2,4 @@ class ResearchOutputConfig(AppConfig): - name = 'research_output' + name = 'coldfront.core.research_output' diff --git a/coldfront/core/resource/apps.py b/coldfront/core/resource/apps.py index a23f0de0a..5c46681e0 100644 --- a/coldfront/core/resource/apps.py +++ b/coldfront/core/resource/apps.py @@ -2,4 +2,4 @@ class ResourceConfig(AppConfig): - name = 'resource' + name = 'coldfront.core.resource' diff --git a/coldfront/core/utils/apps.py b/coldfront/core/utils/apps.py index 7527884c0..16ceeb1a3 100644 --- a/coldfront/core/utils/apps.py +++ b/coldfront/core/utils/apps.py @@ -2,4 +2,5 @@ class UtilsConfig(AppConfig): - name = 'utils' + name = 'coldfront.core.utils' + verbose_name = 'Coldfront Utils' From 356637bec0ae331bc5df68f509b91112e4104079 Mon Sep 17 00:00:00 2001 From: "Andrew E. Bruno" Date: Thu, 13 Jan 2022 11:52:59 -0500 Subject: [PATCH 4/8] Bump Django to 3.2.11 and upgrade all packages --- requirements.txt | 30 ++++++++++++++-------------- setup.py | 52 ++++++++++++++++++++++++------------------------ 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/requirements.txt b/requirements.txt index 48d5ea741..b64efb845 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,12 @@ -arrow==1.1.1 +arrow==1.2.1 bibtexparser==1.2.0 -blessed==1.18.1 +blessed==1.19.0 chardet==4.0.0 -Django==3.2.6 -django-crispy-forms==1.12.0 -Faker==8.12.1 -django-environ==0.4.5 -django-model-utils==4.1.1 +Django==3.2.11 +django-crispy-forms==1.13.0 +Faker==11.3.0 +django-environ==0.8.1 +django-model-utils==4.2.0 django-picklefield==3.0.1 django-q==1.3.9 django-settings-export==1.2.1 @@ -15,18 +15,18 @@ django-split-settings==1.1.0 django-sslserver==0.22 django-su==0.9.0 doi2bib==0.4.0 -factory-boy==3.2.0 +factory-boy==3.2.1 future==0.18.2 -humanize==3.11.0 -idna==3.2 -pyparsing==2.4.7 +humanize==3.13.1 +idna==3.3 +pyparsing==3.0.6 python-dateutil==2.8.2 python-memcached==1.59 -pytz==2021.1 +pytz==2021.3 redis==3.5.3 -requests==2.26.0 +requests==2.27.1 six==1.16.0 -sqlparse==0.4.1 +sqlparse==0.4.2 text-unidecode==1.3 -urllib3==1.26.6 +urllib3==1.26.8 wcwidth==0.2.5 diff --git a/setup.py b/setup.py index c1f56779a..8380fdc35 100644 --- a/setup.py +++ b/setup.py @@ -24,34 +24,34 @@ python_requires='>=3.6', packages=find_packages(), install_requires=[ - 'arrow==0.13.1', - 'bibtexparser==1.1.0', - 'blessed==1.15.0', - 'chardet==3.0.4', - 'Django==2.2.26', - 'django-crispy-forms==1.7.2', - 'django-environ==0.4.5', - 'django-model-utils==3.1.2', - 'django-picklefield==2.0', - 'django-q==1.0.1', + 'arrow==1.2.1', + 'bibtexparser==1.2.0', + 'blessed==1.19.0', + 'chardet==4.0.0', + 'Django==3.2.11', + 'django-crispy-forms==1.13.0', + 'django-environ==0.8.1', + 'django-model-utils==4.2.0', + 'django-picklefield==3.0.1', + 'django-q==1.3.9', 'django-settings-export==1.2.1', - 'django-simple-history==2.7.2', - 'django-split-settings==1.0.1', - 'django-sslserver==0.20', - 'django-su==0.8.0', - 'doi2bib==0.3.0', - 'future==0.17.1', - 'humanize==0.5.1', - 'idna==2.8', - 'pyparsing==2.3.1', - 'python-dateutil==2.8.0', + 'django-simple-history==3.0.0', + 'django-split-settings==1.1.0', + 'django-sslserver==0.22', + 'django-su==0.9.0', + 'doi2bib==0.4.0', + 'future==0.18.2', + 'humanize==3.13.1', + 'idna==3.3', + 'pyparsing==3.0.6', + 'python-dateutil==2.8.2', 'python-memcached==1.59', - 'pytz==2018.9', - 'redis==3.2.1', - 'requests==2.26.0', - 'six==1.12.0', - 'urllib3==1.26.6', - 'wcwidth==0.1.7', + 'pytz==2021.3', + 'redis==3.5.3', + 'requests==2.27.1', + 'six==1.16.0', + 'urllib3==1.26.8', + 'wcwidth==0.2.5', ], entry_points={ 'console_scripts': [ From e04ec9e0c8eac529a9f853ff7f30cd07c0a021bb Mon Sep 17 00:00:00 2001 From: "Andrew E. Bruno" Date: Thu, 13 Jan 2022 11:54:51 -0500 Subject: [PATCH 5/8] staticfiles removed in Django 3.2 --- coldfront/core/portal/templates/portal/center_summary.html | 2 +- coldfront/core/user/templates/user/login.html | 2 +- coldfront/core/user/templates/user/user_profile.html | 2 +- coldfront/core/user/templates/user/user_projects_managers.html | 2 +- .../templates/system_monitor/system_monitor_div.html | 2 +- coldfront/templates/common/base.html | 1 - 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/coldfront/core/portal/templates/portal/center_summary.html b/coldfront/core/portal/templates/portal/center_summary.html index 0a7ffa746..93b3c5eed 100644 --- a/coldfront/core/portal/templates/portal/center_summary.html +++ b/coldfront/core/portal/templates/portal/center_summary.html @@ -1,6 +1,6 @@ {% extends "common/base.html" %} {% load crispy_forms_tags %} -{% load staticfiles %} +{% load static %} {% load common_tags %} {% load humanize %} diff --git a/coldfront/core/user/templates/user/login.html b/coldfront/core/user/templates/user/login.html index ba5f9ccc4..08e0af507 100644 --- a/coldfront/core/user/templates/user/login.html +++ b/coldfront/core/user/templates/user/login.html @@ -1,5 +1,5 @@ {% extends "common/base.html" %} -{% load staticfiles %} +{% load static %} {% load common_tags %} diff --git a/coldfront/core/user/templates/user/user_profile.html b/coldfront/core/user/templates/user/user_profile.html index 5bd1be8f5..18a7b0899 100644 --- a/coldfront/core/user/templates/user/user_profile.html +++ b/coldfront/core/user/templates/user/user_profile.html @@ -1,5 +1,5 @@ {% extends "common/base.html" %} -{% load staticfiles %} +{% load static %} {% block title %} User Profile{% if not user == viewed_user %}: {{ viewed_user.username }}{% endif %} diff --git a/coldfront/core/user/templates/user/user_projects_managers.html b/coldfront/core/user/templates/user/user_projects_managers.html index 184efb852..1f3bc39e6 100644 --- a/coldfront/core/user/templates/user/user_projects_managers.html +++ b/coldfront/core/user/templates/user/user_projects_managers.html @@ -1,5 +1,5 @@ {% extends "common/base.html" %} -{% load staticfiles %} +{% load static %} {% block title %} diff --git a/coldfront/plugins/system_monitor/templates/system_monitor/system_monitor_div.html b/coldfront/plugins/system_monitor/templates/system_monitor/system_monitor_div.html index 8c5c98e40..6644df65c 100644 --- a/coldfront/plugins/system_monitor/templates/system_monitor/system_monitor_div.html +++ b/coldfront/plugins/system_monitor/templates/system_monitor/system_monitor_div.html @@ -1,5 +1,5 @@ -{% load staticfiles %} +{% load static %}
diff --git a/coldfront/templates/common/base.html b/coldfront/templates/common/base.html index 1bd7992e7..9ae323805 100644 --- a/coldfront/templates/common/base.html +++ b/coldfront/templates/common/base.html @@ -1,5 +1,4 @@ {% load static %} -{% load staticfiles %} From ebf35a701fe8e4939572d4602c513e7fd6d40a96 Mon Sep 17 00:00:00 2001 From: "Andrew E. Bruno" Date: Thu, 13 Jan 2022 11:57:51 -0500 Subject: [PATCH 6/8] Core config changes for Django 3.2. - Set DEFAULT_AUTO_FIELD to maintain the historical behavior and avoid unwanted migrations. In future Django release the default value will be changed to BigAutoField. - Set AppConfig.default to False to prevent Django from auto selecting app configuration - Django Q now requires setting retry/timeout values. It's important that the timeout value be less that the retry value. --- coldfront/config/base.py | 19 +++++++++++++++++++ docs/pages/config.md | 2 ++ 2 files changed, 21 insertions(+) diff --git a/coldfront/config/base.py b/coldfront/config/base.py index decf71298..6dd8e50c3 100644 --- a/coldfront/config/base.py +++ b/coldfront/config/base.py @@ -3,6 +3,7 @@ """ import os import coldfront +from django.apps import AppConfig from django.core.exceptions import ImproperlyConfigured from django.core.management.utils import get_random_secret_key from coldfront.config.env import ENV, PROJECT_ROOT @@ -33,6 +34,15 @@ #------------------------------------------------------------------------------ # Django Apps #------------------------------------------------------------------------------ + +# See: https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys +# We should change this to BigAutoField at some point +DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + +# Set this attribute to False to prevent Django from selecting a configuration +# class automatically. See: https://docs.djangoproject.com/en/3.2/ref/applications/#configuring-applications +AppConfig.default = False + INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', @@ -84,6 +94,15 @@ #------------------------------------------------------------------------------ AUTHENTICATION_BACKENDS = [] +#------------------------------------------------------------------------------ +# Django Q +#------------------------------------------------------------------------------ +Q_CLUSTER = { + 'timeout': ENV.int('Q_CLUSTER_TIMEOUT', default=120), + 'retry': ENV.int('Q_CLUSTER_RETRY', default=120), +} + + #------------------------------------------------------------------------------ # Django template and site settings #------------------------------------------------------------------------------ diff --git a/docs/pages/config.md b/docs/pages/config.md index ff94f7419..d4890336d 100644 --- a/docs/pages/config.md +++ b/docs/pages/config.md @@ -64,6 +64,8 @@ more advanced configuration use `local_settings.py`. | SECRET_KEY | This is used to provide cryptographic signing, and should be set to a unique, unpredictable value. [See here](https://docs.djangoproject.com/en/3.1/ref/settings/#secret-key). If you don't provide this one will be generated each time ColdFront starts. | | LANGUAGE_CODE | A string representing the language code. [See here](https://docs.djangoproject.com/en/3.1/ref/settings/#language-code) | TIME_ZONE | A string representing the time zone for this installation. [See here](https://docs.djangoproject.com/en/3.1/ref/settings/#std:setting-TIME_ZONE) | +| Q_CLUSTER_RETRY | The number of seconds Django Q broker will wait for a cluster to finish a task. [See here](https://django-q.readthedocs.io/en/latest/configure.html#retry) | +| Q_CLUSTER_TIMEOUT | The number of seconds a Django Q worker is allowed to spend on a task before it’s terminated. IMPORTANT NOTE: Q_CLUSTER_TIMEOUT must be less than Q_CLUSTER_RETRY. [See here](https://django-q.readthedocs.io/en/latest/configure.html#timeout) | ### Template settings From 8da8648e8e8dae01a5cba8131737ddfcda8d520a Mon Sep 17 00:00:00 2001 From: "Andrew E. Bruno" Date: Thu, 13 Jan 2022 14:50:02 -0500 Subject: [PATCH 7/8] Re-enable automatic app discovery. - Ensure plugins use dotted path for app config --- coldfront/config/base.py | 5 ----- coldfront/plugins/iquota/apps.py | 2 +- coldfront/plugins/ldap_user_search/apps.py | 2 +- coldfront/plugins/mokey_oidc/apps.py | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/coldfront/config/base.py b/coldfront/config/base.py index 6dd8e50c3..e65d1647a 100644 --- a/coldfront/config/base.py +++ b/coldfront/config/base.py @@ -3,7 +3,6 @@ """ import os import coldfront -from django.apps import AppConfig from django.core.exceptions import ImproperlyConfigured from django.core.management.utils import get_random_secret_key from coldfront.config.env import ENV, PROJECT_ROOT @@ -39,10 +38,6 @@ # We should change this to BigAutoField at some point DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' -# Set this attribute to False to prevent Django from selecting a configuration -# class automatically. See: https://docs.djangoproject.com/en/3.2/ref/applications/#configuring-applications -AppConfig.default = False - INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', diff --git a/coldfront/plugins/iquota/apps.py b/coldfront/plugins/iquota/apps.py index 8fbd52ea0..f257a970b 100644 --- a/coldfront/plugins/iquota/apps.py +++ b/coldfront/plugins/iquota/apps.py @@ -2,4 +2,4 @@ class IquotaConfig(AppConfig): - name = 'iquota' + name = 'coldfront.plugins.iquota' diff --git a/coldfront/plugins/ldap_user_search/apps.py b/coldfront/plugins/ldap_user_search/apps.py index ef27e3add..8b5610bb1 100644 --- a/coldfront/plugins/ldap_user_search/apps.py +++ b/coldfront/plugins/ldap_user_search/apps.py @@ -2,4 +2,4 @@ class LdapUserSearchConfig(AppConfig): - name = 'ldap_user_search' + name = 'coldfront.plugins.ldap_user_search' diff --git a/coldfront/plugins/mokey_oidc/apps.py b/coldfront/plugins/mokey_oidc/apps.py index ba6df5f20..47c44765a 100644 --- a/coldfront/plugins/mokey_oidc/apps.py +++ b/coldfront/plugins/mokey_oidc/apps.py @@ -2,4 +2,4 @@ class MokeyOidcConfig(AppConfig): - name = 'mokey_oidc' + name = 'coldfront.plugins.mokey_oidc' From 8af1dd3da7fd3749db8063fdc0276469f78499f5 Mon Sep 17 00:00:00 2001 From: "Andrew E. Bruno" Date: Tue, 1 Feb 2022 20:53:49 -0500 Subject: [PATCH 8/8] Bump django --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index b64efb845..70ffee74e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ arrow==1.2.1 bibtexparser==1.2.0 blessed==1.19.0 chardet==4.0.0 -Django==3.2.11 +Django==3.2.12 django-crispy-forms==1.13.0 Faker==11.3.0 django-environ==0.8.1 diff --git a/setup.py b/setup.py index 8380fdc35..fca143875 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ 'bibtexparser==1.2.0', 'blessed==1.19.0', 'chardet==4.0.0', - 'Django==3.2.11', + 'Django==3.2.12', 'django-crispy-forms==1.13.0', 'django-environ==0.8.1', 'django-model-utils==4.2.0',