From 2f866ae3cca5031624155928159e4232932bf4ef Mon Sep 17 00:00:00 2001 From: ted Liefeld Date: Wed, 6 Sep 2023 07:12:36 -0700 Subject: [PATCH 1/4] adding guard clause --- caper/caper/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/caper/caper/views.py b/caper/caper/views.py index 435acfe..e40487d 100644 --- a/caper/caper/views.py +++ b/caper/caper/views.py @@ -155,9 +155,12 @@ def get_one_sample(project_name, sample_name): runs = project['runs'] for sample_num in runs.keys(): current = runs[sample_num] - if len(current) > 0 and current[0]['Sample_name'] == sample_name: - sample_out = current - + try: + if len(current) > 0 and current[0]['Sample_name'] == sample_name: + sample_out = current + except: + # should not get here but we do sometimes for new projects, issue 194 + sample_out = None return project, sample_out From 92d312648df42f2f2c04e701a281c14cc568a8b7 Mon Sep 17 00:00:00 2001 From: liefeld Date: Wed, 6 Sep 2023 18:19:05 +0000 Subject: [PATCH 2/4] issues 194,195,196, adding email config for reset passsword and setting new base template for all the allauth forms --- caper/caper/settings.py | 17 ++++- caper/templates/account/base.html | 113 ++++++++++++++++++++++++++++++ start-server.sh | 2 +- 3 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 caper/templates/account/base.html diff --git a/caper/caper/settings.py b/caper/caper/settings.py index 1081e13..307e138 100644 --- a/caper/caper/settings.py +++ b/caper/caper/settings.py @@ -1,5 +1,6 @@ import os from django.utils.translation import gettext_lazy as _ +import logging ###################### # MEZZANINE SETTINGS # @@ -139,7 +140,19 @@ # turn off email authentication when a user registers an account ACCOUNT_EMAIL_VERIFICATION = 'none' ACCOUNT_EMAIL_REQUIRED = False -EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + +EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +#ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS = os.environ['ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS'] + +EMAIL_HOST = 'smtp.gmail.com' #new +EMAIL_PORT = 587 #new +EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER', default="") #new +EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD', default="") +EMAIL_USE_TLS = True #new + +logging.error("EMAIL ") +logging.error( EMAIL_HOST_USER) + #ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS = os.environ['ACCOUNT_AUTHENTICATED_LOGIN_REDIRECTS'] SECRET_KEY = 'c4nc3r' @@ -320,7 +333,6 @@ ################ INSTALLED_APPS = [ - 'caper', "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", @@ -341,6 +353,7 @@ "mezzanine.pages", "mezzanine.forms", "mezzanine.galleries", + "caper", # "mezzanine.twitter", # 'mezzanine.accounts', 'allauth', diff --git a/caper/templates/account/base.html b/caper/templates/account/base.html new file mode 100644 index 0000000..edc1129 --- /dev/null +++ b/caper/templates/account/base.html @@ -0,0 +1,113 @@ + +{% load pages_tags mezzanine_tags i18n static %} + + + + + + + + + {% block meta_title %}{% endblock %}{% if settings.SITE_TITLE %} | {{ settings.SITE_TITLE }}{% endif %} + + {# Load the tag library #} + {% load bootstrap4 %} + + {# Load CSS and JavaScript #} + {% bootstrap_css %} + {% bootstrap_javascript jquery='full' %} + + {# Display django.contrib.messages as Bootstrap alerts #} + {% bootstrap_messages %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% block extra_css %} + {% endblock %} + + {% block extra_js %} + + + + + {% endblock %} + + + + + + + + + + + + + + + {% page_menu "includes/header.html" %} + + {% block index %} +
+
+ + + + + {% block main-container %} +
+ {% block main %}{% endblock %} + {% block content %}{% endblock %} +
+ {% endblock main-container %} +
+
+ + {% endblock index %} + + {% page_menu "includes/footer.html" %} + {% include "includes/footer_scripts.html" %} + + + + diff --git a/start-server.sh b/start-server.sh index 5a72b0c..dcca877 100755 --- a/start-server.sh +++ b/start-server.sh @@ -7,6 +7,6 @@ source caper/config.sh #docker run -d --rm --name=amplicon-prod -p 80:8000 -v /home/ubuntu/AmpliconRepository-prod/logs:/srv/logs -v /home/ubuntu/AmpliconRepository-prod/caper:/srv/caper/ -w /srv/ --env GOOGLE_SECRET_KEY --env GLOBUS_SECRET_KEY --env DB_URI --env DB_NAME --env S3_STATIC_FILES -t genepattern/amplicon-repo:dev /srv/run-manage-py.sh #docker rm amplicon-prod -docker run -d --name=amplicon-${AMPLICON_ENV} -p ${AMPLICON_ENV_PORT}:8000 -v /home/ubuntu/.aws:/root/.aws -v ${CAPER_ROOT}/logs:/srv/logs -v ${CAPER_ROOT}:/srv/ -w /srv/caper -v ${CAPER_ROOT}/.git:/srv/.git --env GOOGLE_SECRET_KEY --env GLOBUS_SECRET_KEY --env DB_URI --env DB_NAME --env S3_STATIC_FILES --env S3_FILE_DOWNLOADS -t genepattern/amplicon-repo:${AMPLICON_ENV} /srv/run-manage-py.sh +docker run -d --name=amplicon-${AMPLICON_ENV} -p ${AMPLICON_ENV_PORT}:8000 -v /home/ubuntu/.aws:/root/.aws -v ${CAPER_ROOT}/logs:/srv/logs -v ${CAPER_ROOT}:/srv/ -w /srv/caper -v ${CAPER_ROOT}/.git:/srv/.git --env EMAIL_HOST_USER --env EMAIL_HOST_PASSWORD --env GOOGLE_SECRET_KEY --env GLOBUS_SECRET_KEY --env DB_URI --env DB_NAME --env S3_STATIC_FILES --env S3_FILE_DOWNLOADS -t genepattern/amplicon-repo:${AMPLICON_ENV} /srv/run-manage-py.sh From 93430aef0b436d7ac9f5e02dbd91671bbbaeca41 Mon Sep 17 00:00:00 2001 From: liefeld Date: Wed, 6 Sep 2023 19:55:40 +0000 Subject: [PATCH 3/4] add jquery to put bootstrap classes on buttons after load for the allauth forms --- caper/templates/account/base.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/caper/templates/account/base.html b/caper/templates/account/base.html index edc1129..08da352 100644 --- a/caper/templates/account/base.html +++ b/caper/templates/account/base.html @@ -66,12 +66,25 @@ $(function () { $('[data-toggle="tooltip"]').tooltip() }) + + + window.onload = function(){ + $("input[type='submit']").addClass("btn btn-primary"); + } {% endblock %} + + + @@ -83,7 +96,7 @@ {% page_menu "includes/header.html" %} - +
{% block index %}
From d63e7d221bbd10680cfb7a2565712d0c4c1bfbe5 Mon Sep 17 00:00:00 2001 From: jluebeck Date: Wed, 6 Sep 2023 14:15:42 -0700 Subject: [PATCH 4/4] set the logging level --- README.md | 4 +++- caper/caper/settings.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 77b309a..096c320 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # AmpliconRepository -#### Authors: Forrest Kim, Jens Luebeck, Ted Liefeld, Edwin Huang, Gino Prasad, Rohil Ahuja, Rishaan Kenkre, Tushar Agashe, Devika Torvi, Thorin Tabor, Vineet Bafna +#### Authors: Forrest Kim, Jens Luebeck, Ted Liefeld, Edwin Huang, Gino Prasad, Rohil Ahuja, Rishaan Kenkre, Tushar Agashe, Devika Torvi, Madalina Giurgiu, Thorin Tabor, Vineet Bafna + --- This is the main repository for the AmpliconRepository. @@ -52,6 +53,7 @@ This is the main repository for the AmpliconRepository. ## 3. Set up MongoDB locally (for development) - Install MongoDB - In Ubuntu this can be done with `sudo apt install mongodb-server-core` + - For newer versions of Ubuntu (e.g. 22.04+), follow the instructions here: https://www.fosstechnix.com/how-to-install-mongodb-on-ubuntu-22-04-lts/ - In macOS this can be done with >`git config --global init.defaultBranch main` diff --git a/caper/caper/settings.py b/caper/caper/settings.py index 307e138..5ba03ed 100644 --- a/caper/caper/settings.py +++ b/caper/caper/settings.py @@ -2,6 +2,9 @@ from django.utils.translation import gettext_lazy as _ import logging +logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', + level=logging.DEBUG, datefmt='%Y-%m-%d %H:%M:%S') + ###################### # MEZZANINE SETTINGS # ######################