From 912381e4ca06fc9ab7a94a1aebac4890eb80dfef Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Tue, 27 Jun 2023 17:03:52 -0500 Subject: [PATCH 01/20] feat(example): core-cms v3.11.3 --- example_cms/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example_cms/Dockerfile b/example_cms/Dockerfile index cb374f74..7fc0571e 100644 --- a/example_cms/Dockerfile +++ b/example_cms/Dockerfile @@ -1,5 +1,5 @@ -# v3.9.3 -FROM taccwma/core-cms:4ef3608 +# v3.11.3 +FROM taccwma/core-cms:5cc1b06 WORKDIR /code From b23bfac37055fc2ea73fde42233deb47d7cb64fc Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 1 Sep 2023 16:52:06 -0500 Subject: [PATCH 02/20] chore: move e-mail settings to same spot --- apcd-cms/src/taccsite_cms/settings_custom.py | 19 +++++++++--------- .../src/taccsite_cms/settings_custom.py | 20 +++++++++---------- .../src/taccsite_cms/settings_custom.py | 19 +++++++++--------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/apcd-cms/src/taccsite_cms/settings_custom.py b/apcd-cms/src/taccsite_cms/settings_custom.py index 13dd84b3..083eb391 100644 --- a/apcd-cms/src/taccsite_cms/settings_custom.py +++ b/apcd-cms/src/taccsite_cms/settings_custom.py @@ -2,6 +2,15 @@ # TACC WMA CMS SITE: # *.APCD.TACC.UTEXAS.EDU +######################## +# DJANGO (EMAIL) +######################## + +# Set on server, NOT here +# https://confluence.tacc.utexas.edu/x/coR9E +# EMAIL_BACKEND = "..." +# EMAIL_HOST = "..." +# DEFAULT_FROM_EMAIL = "..." ######################## # DJANGO CMS SETTINGS @@ -35,13 +44,3 @@ FAVICON = { "img_file_src": "apcd-cms/img/favicons/favicon.ico" } - -######################## -# DJANGO (EMAIL) -######################## - -# Set on server, NOT here -# https://confluence.tacc.utexas.edu/x/coR9E -# EMAIL_BACKEND = "..." -# EMAIL_HOST = "..." -# DEFAULT_FROM_EMAIL = "..." diff --git a/example_cms/src/taccsite_cms/settings_custom.py b/example_cms/src/taccsite_cms/settings_custom.py index 081a43c0..6419e0bb 100644 --- a/example_cms/src/taccsite_cms/settings_custom.py +++ b/example_cms/src/taccsite_cms/settings_custom.py @@ -2,6 +2,16 @@ # TACC WMA CMS SITE: # *.PROJECT_DOMAIN.TACC.UTEXAS.EDU +######################## +# DJANGO (EMAIL) +######################## + +# Set on server, NOT here +# https://confluence.tacc.utexas.edu/x/coR9E +# EMAIL_BACKEND = "..." +# EMAIL_HOST = "..." +# DEFAULT_FROM_EMAIL = "..." + ######################## # DJANGO CMS SETTINGS ######################## @@ -22,16 +32,6 @@ # ('guides/portal_technology.html', 'Guide: Portal Technology Stack'), # ) -######################## -# DJANGO (EMAIL) -######################## - -# Set on server, NOT here -# https://confluence.tacc.utexas.edu/x/coR9E -# EMAIL_BACKEND = "..." -# EMAIL_HOST = "..." -# DEFAULT_FROM_EMAIL = "..." - ######################## # TACC: BRANDING ######################## diff --git a/matcssi_cms/src/taccsite_cms/settings_custom.py b/matcssi_cms/src/taccsite_cms/settings_custom.py index 625b8254..827d2fda 100644 --- a/matcssi_cms/src/taccsite_cms/settings_custom.py +++ b/matcssi_cms/src/taccsite_cms/settings_custom.py @@ -2,6 +2,15 @@ # TACC WMA CMS SITE: # *.MISE.TACC.UTEXAS.EDU +######################## +# DJANGO (EMAIL) +######################## + +# Set on server, NOT here +# https://confluence.tacc.utexas.edu/x/coR9E +# EMAIL_BACKEND = "..." +# EMAIL_HOST = "..." +# DEFAULT_FROM_EMAIL = "..." ######################## # TACC: LOGOS @@ -21,13 +30,3 @@ FAVICON = { "img_file_src": "matcssi_cms/img/favicons/favicon.ico" } - -######################## -# DJANGO (EMAIL) -######################## - -# Set on server, NOT here -# https://confluence.tacc.utexas.edu/x/coR9E -# EMAIL_BACKEND = "..." -# EMAIL_HOST = "..." -# DEFAULT_FROM_EMAIL = "..." From 5c588d449e40cdb153ef5eb22c51ebdcb891fad9 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 1 Sep 2023 16:55:29 -0500 Subject: [PATCH 03/20] chore: move all images to /img, no child dirs --- example_cms/src/taccsite_cms/settings_custom.py | 8 ++++++-- .../example_cms/img/{favicons => }/favicon.ico | Bin .../example_cms/img/{org_logos => }/portal.png | Bin 3 files changed, 6 insertions(+), 2 deletions(-) rename example_cms/src/taccsite_custom/example_cms/static/example_cms/img/{favicons => }/favicon.ico (100%) rename example_cms/src/taccsite_custom/example_cms/static/example_cms/img/{org_logos => }/portal.png (100%) diff --git a/example_cms/src/taccsite_cms/settings_custom.py b/example_cms/src/taccsite_cms/settings_custom.py index 6419e0bb..cf846980 100644 --- a/example_cms/src/taccsite_cms/settings_custom.py +++ b/example_cms/src/taccsite_cms/settings_custom.py @@ -40,7 +40,7 @@ # # _CUSTOM_BRANDING = [ # "example", -# "example_cms/img/org_logos/example-logo.png", +# "example_cms/img/some-logo.png", # "", # "https://example.com", # "_blank", @@ -57,7 +57,7 @@ LOGO = [ "example", - "example_cms/img/org_logos/portal.png", + "example_cms/img/portal.png", "", "/", "_self", @@ -66,6 +66,10 @@ "True" ] +FAVICON = { + "img_file_src": "example_cms/img/favicon.ico" +} + ######################## # TACC: PORTAL ######################## diff --git a/example_cms/src/taccsite_custom/example_cms/static/example_cms/img/favicons/favicon.ico b/example_cms/src/taccsite_custom/example_cms/static/example_cms/img/favicon.ico similarity index 100% rename from example_cms/src/taccsite_custom/example_cms/static/example_cms/img/favicons/favicon.ico rename to example_cms/src/taccsite_custom/example_cms/static/example_cms/img/favicon.ico diff --git a/example_cms/src/taccsite_custom/example_cms/static/example_cms/img/org_logos/portal.png b/example_cms/src/taccsite_custom/example_cms/static/example_cms/img/portal.png similarity index 100% rename from example_cms/src/taccsite_custom/example_cms/static/example_cms/img/org_logos/portal.png rename to example_cms/src/taccsite_custom/example_cms/static/example_cms/img/portal.png From dca6cec9efd3d5977e7bd95d36913d07c0bf211b Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 1 Sep 2023 16:56:50 -0500 Subject: [PATCH 04/20] test: remove elasticsearch.yml (core-cms has it) --- example_cms/docker-compose.dev.yml | 1 - example_cms/elasticsearch.yml | 14 -------------- 2 files changed, 15 deletions(-) delete mode 100644 example_cms/elasticsearch.yml diff --git a/example_cms/docker-compose.dev.yml b/example_cms/docker-compose.dev.yml index 2aeb7843..5663fe54 100644 --- a/example_cms/docker-compose.dev.yml +++ b/example_cms/docker-compose.dev.yml @@ -40,7 +40,6 @@ services: - ES_HEAP_SIZE:1g - discovery.type=single-node volumes: - - ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - core_cms_es_data:/usr/share/elasticsearch/data container_name: core_cms_elasticsearch ports: diff --git a/example_cms/elasticsearch.yml b/example_cms/elasticsearch.yml deleted file mode 100644 index 55847499..00000000 --- a/example_cms/elasticsearch.yml +++ /dev/null @@ -1,14 +0,0 @@ -#Use this to configure elasticsearch -#More info: https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html -# -cluster.name: es-dev -network.host: 0.0.0.0 -#network.publish_host: hostname -node.name: es01 -#minimum_master_nodes need to be explicitly set when bound on a public IP -# set to 1 to allow single node clusters -# Details: https://github.com/elastic/elasticsearch/pull/17288 -discovery.zen.minimum_master_nodes: 1 -#More info about memory_lock: https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration-memory.html -bootstrap.memory_lock: true -xpack.security.enabled: false \ No newline at end of file From 786e83d96f76a91f03f13c9e9e579038813c762a Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 1 Sep 2023 17:01:03 -0500 Subject: [PATCH 05/20] chore: set TACC_CORE_STYLES_VERSION = 2 So new projects use v2! Migrated projects, they need to be checking every setting. --- example_cms/src/taccsite_cms/settings_custom.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/example_cms/src/taccsite_cms/settings_custom.py b/example_cms/src/taccsite_cms/settings_custom.py index cf846980..6271c09d 100644 --- a/example_cms/src/taccsite_cms/settings_custom.py +++ b/example_cms/src/taccsite_cms/settings_custom.py @@ -78,3 +78,9 @@ # INCLUDES_CORE_PORTAL = False # INCLUDES_PORTAL_NAV = False # INCLUDES_SEARCH_BAR = False + +######################## +# TACC: CORE STYLES +######################## + +TACC_CORE_STYLES_VERSION = 2 From 14f1ea8696a0f6564432a2102961bd8e7dd983f4 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 1 Sep 2023 17:45:08 -0500 Subject: [PATCH 06/20] feat(example): core cms v3.12.0-beta.3 --- example_cms/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example_cms/Dockerfile b/example_cms/Dockerfile index 7fc0571e..1f34d4cd 100644 --- a/example_cms/Dockerfile +++ b/example_cms/Dockerfile @@ -1,5 +1,5 @@ -# v3.11.3 -FROM taccwma/core-cms:5cc1b06 +# v3.12.0-beta.3 +FROM taccwma/core-cms:cc3e729 WORKDIR /code From 77d012491322f802f683a02f15ecb8ab81fefd84 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 12:43:59 -0500 Subject: [PATCH 07/20] chore: try to clean up diff --- apcd-cms/src/taccsite_cms/settings_custom.py | 2 +- matcssi_cms/src/taccsite_cms/settings_custom.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apcd-cms/src/taccsite_cms/settings_custom.py b/apcd-cms/src/taccsite_cms/settings_custom.py index 083eb391..b617f822 100644 --- a/apcd-cms/src/taccsite_cms/settings_custom.py +++ b/apcd-cms/src/taccsite_cms/settings_custom.py @@ -43,4 +43,4 @@ FAVICON = { "img_file_src": "apcd-cms/img/favicons/favicon.ico" -} +} \ No newline at end of file diff --git a/matcssi_cms/src/taccsite_cms/settings_custom.py b/matcssi_cms/src/taccsite_cms/settings_custom.py index 827d2fda..9b9f8fda 100644 --- a/matcssi_cms/src/taccsite_cms/settings_custom.py +++ b/matcssi_cms/src/taccsite_cms/settings_custom.py @@ -29,4 +29,4 @@ FAVICON = { "img_file_src": "matcssi_cms/img/favicons/favicon.ico" -} +} \ No newline at end of file From e2c7aab2f332c96e4fdddc0e9e38a31deb7a9a84 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 13:12:37 -0500 Subject: [PATCH 08/20] chore: extra new line (for consistency) --- example_cms/src/apps/custom_example/urls.py | 1 + 1 file changed, 1 insertion(+) diff --git a/example_cms/src/apps/custom_example/urls.py b/example_cms/src/apps/custom_example/urls.py index d38dbd09..7ba58e04 100644 --- a/example_cms/src/apps/custom_example/urls.py +++ b/example_cms/src/apps/custom_example/urls.py @@ -1,6 +1,7 @@ from django.urls import re_path from .views import AddedView + app_name = 'custom_example' urlpatterns = [ re_path('', AddedView, name='index'), From b0b18d269ba4a3a4ed91c3e16041b523c71df676 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 13:23:53 -0500 Subject: [PATCH 09/20] feat!: install custom app (FAIL) Breaking Change: Fails with error. ``` django.core.exceptions.ImproperlyConfigured: Cannot import 'custom_example'. Check that 'apps.custom_example.apps.CustomExampleConfig.name' is correct. ``` --- example_cms/src/taccsite_cms/custom_app_settings.py | 2 +- example_cms/src/taccsite_cms/urls_custom.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/example_cms/src/taccsite_cms/custom_app_settings.py b/example_cms/src/taccsite_cms/custom_app_settings.py index a1a905ca..3ac04c50 100644 --- a/example_cms/src/taccsite_cms/custom_app_settings.py +++ b/example_cms/src/taccsite_cms/custom_app_settings.py @@ -1,3 +1,3 @@ -CUSTOM_APPS = [] +CUSTOM_APPS = ['apps.custom_example'] CUSTOM_MIDDLEWARE = [] STATICFILES_DIRS = () diff --git a/example_cms/src/taccsite_cms/urls_custom.py b/example_cms/src/taccsite_cms/urls_custom.py index 03805aef..7856c50a 100644 --- a/example_cms/src/taccsite_cms/urls_custom.py +++ b/example_cms/src/taccsite_cms/urls_custom.py @@ -1,3 +1,5 @@ from django.urls import path, include -custom_urls = [] +custom_urls = [ + path('custom_example/', include('apps.custom_example.urls', namespace='custom_example')), +] From c5654a4a95c766e4b1499e570c646505cb36d262 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 14:25:43 -0500 Subject: [PATCH 10/20] fix: upgrade for Core-CMS v3.12 (i.e. Django 3.2) --- README.md | 6 ++++++ docs/upgrade-project.md | 21 +++++++++++++++++++++ example_cms/src/apps/custom_example/apps.py | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 docs/upgrade-project.md diff --git a/README.md b/README.md index 936d3cfc..234cf814 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Extensions of the [Core CMS] project - [Build Project](#build-project) - [Deploy Project](#deploy-project) - [Port Project](#port-project) +- [Upgrade Project](#upgrade-project) ## Related Repositories @@ -155,6 +156,10 @@ Follow "Core-CMS-Custom" section of [How To Build & Deploy][Deploy Project]. To port a project from [Core CMS Resources], read [Port Project]. +## Upgrade Project + +To upgrade components of an existing project (e.g. [Core CMS]), read [Upgrade Project]. + [Core Portal Deployments]: https://github.com/TACC/Core-Portal-Deployments @@ -170,4 +175,5 @@ To port a project from [Core CMS Resources], read [Port Project]. [Deploy Project]: https://confluence.tacc.utexas.edu/x/Lo99E [Port Project]: ./docs/port-project.md +[Upgrade Project]: ./docs/upgrade-project.md [Django CMS User Guide]: https://confluence.tacc.utexas.edu/x/FgDqCw diff --git a/docs/upgrade-project.md b/docs/upgrade-project.md new file mode 100644 index 00000000..efc54332 --- /dev/null +++ b/docs/upgrade-project.md @@ -0,0 +1,21 @@ +# Upgrade Project + +## Table of Contents + +- [Core-CMS v3.11 to v3.12](#core-cms-v311-to-v312) + 1. [Update Custom Apps](#update-custom-apps) + +## [Core CMS] v3.11 to v3.12 + +### Update Custom Apps + +Update apps to be compatible with Django 3.2 (in [Core CMS] v3.12). + +1. Edit all apps (e.g. `/custom_project_dir/apps/custom_example`). + 1. In each `apps.py` change + - from `name = 'custom_example'` + - to `name = 'apps.custom_example'`. + + + +[Core CMS]: https://github.com/TACC/Core-CMS diff --git a/example_cms/src/apps/custom_example/apps.py b/example_cms/src/apps/custom_example/apps.py index 672181cf..26ebfd16 100644 --- a/example_cms/src/apps/custom_example/apps.py +++ b/example_cms/src/apps/custom_example/apps.py @@ -2,4 +2,4 @@ class CustomExampleConfig(AppConfig): - name = 'custom_example' + name = 'apps.custom_example' From f24c600f2de0bc64f262236946c65fb47368db8e Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 14:42:28 -0500 Subject: [PATCH 11/20] feat: new upgrade path to Core-CMS v3.12 --- docs/upgrade-project.md | 24 +++++++++++++++++---- example_cms/Dockerfile | 2 +- example_cms/docker-compose.dev.yml | 2 +- example_cms/src/apps/custom_example/apps.py | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/upgrade-project.md b/docs/upgrade-project.md index efc54332..5c4fc5ff 100644 --- a/docs/upgrade-project.md +++ b/docs/upgrade-project.md @@ -11,10 +11,26 @@ Update apps to be compatible with Django 3.2 (in [Core CMS] v3.12). -1. Edit all apps (e.g. `/custom_project_dir/apps/custom_example`). - 1. In each `apps.py` change - - from `name = 'custom_example'` - - to `name = 'apps.custom_example'`. +1. In `/custom_project_dir/Dockerfile`, move apps to `taccsite_cms`, i.e. + + | | change | + | - | - | + | from | `COPY /src/apps /code/apps` | + | to | `COPY /src/apps /code/taccsite_cms/apps` | + +1. In `/custom_project_dir/docker-compose.dev.yml`, sync apps in `taccsite_cms`, i.e. + + | | change | + | - | - | + | from | `- ./src/apps:/code/apps` | + | to | `- ./src/apps:/code/taccsite_cms/apps` | + +2. In `/custom_project_dir/taccsite_cms/custom_app_settings.py`, remove apps from `STATICFILES_DIRS`, i.e. + + | | change | + | - | - | + | from | `STATICFILES_DIRS = ('apps/custom_example', ...)` | + | to | `STATICFILES_DIRS = (...)` | diff --git a/example_cms/Dockerfile b/example_cms/Dockerfile index 1f34d4cd..ad1fb126 100644 --- a/example_cms/Dockerfile +++ b/example_cms/Dockerfile @@ -3,6 +3,6 @@ FROM taccwma/core-cms:cc3e729 WORKDIR /code -COPY /src/apps /code/apps +COPY /src/apps /code/taccsite_cms/apps COPY /src/taccsite_custom /code/taccsite_custom COPY /src/taccsite_cms /code/taccsite_cms diff --git a/example_cms/docker-compose.dev.yml b/example_cms/docker-compose.dev.yml index 5663fe54..4237a950 100644 --- a/example_cms/docker-compose.dev.yml +++ b/example_cms/docker-compose.dev.yml @@ -8,7 +8,7 @@ services: container_name: core_cms hostname: core_cms volumes: - - ./src/apps:/code/apps + - ./src/apps:/code/taccsite_cms/apps - ./src/taccsite_custom:/code/taccsite_custom - ./src/taccsite_cms/custom_app_settings.py:/code/taccsite_cms/custom_app_settings.py - ./src/taccsite_cms/urls_custom.py:/code/taccsite_cms/urls_custom.py diff --git a/example_cms/src/apps/custom_example/apps.py b/example_cms/src/apps/custom_example/apps.py index 26ebfd16..672181cf 100644 --- a/example_cms/src/apps/custom_example/apps.py +++ b/example_cms/src/apps/custom_example/apps.py @@ -2,4 +2,4 @@ class CustomExampleConfig(AppConfig): - name = 'apps.custom_example' + name = 'custom_example' From 6593b5b94ed3468b68da177fba248b9850be05d1 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 15:07:53 -0500 Subject: [PATCH 12/20] docs(port-project): small improvements --- docs/port-project.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/port-project.md b/docs/port-project.md index ed3a224c..490983be 100644 --- a/docs/port-project.md +++ b/docs/port-project.md @@ -30,7 +30,7 @@ Follow steps in [Create a New Project](./develop-project.md#create-a-new-project 3. The name `custom_project_dir` **must** use underscores, **not** dashes. - > **Note** + > **Important** > A valid Python application uses underscores. @@ -51,12 +51,13 @@ Then: 3. Change `_PORTAL_ICON_FILENAME` to:\ `/static/` + ( the `img_file_src` of `FAVICON` ) -#### Old Custom Templates Directory +#### Old CMS Template Paths **If** the custom project directory: - **both** had a name with dashes in [Core CMS Resources] -- **and** has any `templates/*.html` e.g.: +- **and** has any of **these** templates: + - `templates/home.html` - `templates/standard.html` - `templates/fullwidth.html` From 7edb91f0b8a7f28332b4ff003024a91136bd98c7 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 15:08:29 -0500 Subject: [PATCH 13/20] docs(upgrade-project): add "Rename Project" And make some small fixes. --- docs/upgrade-project.md | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/upgrade-project.md b/docs/upgrade-project.md index 5c4fc5ff..ad4d34dd 100644 --- a/docs/upgrade-project.md +++ b/docs/upgrade-project.md @@ -3,13 +3,34 @@ ## Table of Contents - [Core-CMS v3.11 to v3.12](#core-cms-v311-to-v312) - 1. [Update Custom Apps](#update-custom-apps) + 1. [Rename Project](#rename-project) + 2. [Update Custom Apps](#update-custom-apps) ## [Core CMS] v3.11 to v3.12 +### Rename Project + +Verify project name is compatible with Django 3.2. + +1. If you project directory name has dashes, rename it to use underscores, i.e. + + | | root | `taccsite_custom` | + | - | - | - | + | from | `custom-project-dir` | `taccsite_custom/custom-project-dir` | + | to | `custom_project_dir` | `taccsite_custom/custom_project_dir` | + + > **Important** + > A valid Python application uses underscores. + +2. Rename **all** references to the previous directory name. + +#### Old CMS Template Paths + +To identify and support and deprecate such template paths, read [Port Project: Old CMS Template paths](./port-project.md#old-cms-template-paths). + ### Update Custom Apps -Update apps to be compatible with Django 3.2 (in [Core CMS] v3.12). +Update project apps to be meet Django expectations. 1. In `/custom_project_dir/Dockerfile`, move apps to `taccsite_cms`, i.e. @@ -18,14 +39,14 @@ Update apps to be compatible with Django 3.2 (in [Core CMS] v3.12). | from | `COPY /src/apps /code/apps` | | to | `COPY /src/apps /code/taccsite_cms/apps` | -1. In `/custom_project_dir/docker-compose.dev.yml`, sync apps in `taccsite_cms`, i.e. +2. In `/custom_project_dir/docker-compose.dev.yml`, sync apps in `taccsite_cms`, i.e. | | change | | - | - | | from | `- ./src/apps:/code/apps` | | to | `- ./src/apps:/code/taccsite_cms/apps` | -2. In `/custom_project_dir/taccsite_cms/custom_app_settings.py`, remove apps from `STATICFILES_DIRS`, i.e. +3. In `/custom_project_dir/taccsite_cms/custom_app_settings.py`, remove apps from `STATICFILES_DIRS`, i.e. | | change | | - | - | From a4f170d65b0c01504796c577430967f1d2e0a82f Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 15:15:32 -0500 Subject: [PATCH 14/20] docs(upgrade-project): refactor "Rename Project" --- docs/upgrade-project.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/upgrade-project.md b/docs/upgrade-project.md index ad4d34dd..73844969 100644 --- a/docs/upgrade-project.md +++ b/docs/upgrade-project.md @@ -14,19 +14,32 @@ Verify project name is compatible with Django 3.2. 1. If you project directory name has dashes, rename it to use underscores, i.e. - | | root | `taccsite_custom` | - | - | - | - | - | from | `custom-project-dir` | `taccsite_custom/custom-project-dir` | - | to | `custom_project_dir` | `taccsite_custom/custom_project_dir` | + | | root | + | - | - | + | from | `custom-project-dir` | + | to | `custom_project_dir` | + + | | `taccsite_custom` | + | - | - | + | from | `taccsite_custom/custom-project-dir` | + | to | `taccsite_custom/custom_project_dir` | + + | |`taccsite_cms/static` | + | - | - | + | from | `taccsite_cms/static/custom-project-dir` | + | to | `taccsite_cms/static/custom_project_dir` | > **Important** > A valid Python application uses underscores. -2. Rename **all** references to the previous directory name. +2. Rename **all** references to the previous directory names. + +3. Identify, support and deprecate old CMS template paths. -#### Old CMS Template Paths + Follow [Port Project: Old CMS Template paths](./port-project.md#old-cms-template-paths). -To identify and support and deprecate such template paths, read [Port Project: Old CMS Template paths](./port-project.md#old-cms-template-paths). + > **Important** + > Failure to do this can crash an entire page. ### Update Custom Apps From a18ce6f8db611b4c4c48ef842039ca18e51b3f9a Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 15:18:14 -0500 Subject: [PATCH 15/20] docs(develop-project): apps are moved --- docs/develop-project.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/develop-project.md b/docs/develop-project.md index 4a8147c7..1df00c10 100644 --- a/docs/develop-project.md +++ b/docs/develop-project.md @@ -35,7 +35,7 @@ Read [Django CMS User Guide] for CMS user instructions. | If Project Does Not Need | Then Delete | | - | - | -| additional apps | `apps/`
`COPY /src/apps /code/apps` (in `Dockerfile`) | +| additional apps | the directory `apps/`
the `COPY /src/apps /code/taccsite_cms/apps` in `Dockerfile` | | URLs for custom apps | `urls_custom.py` | | custom code | `custom_app_settings.py` | From ac836d54da982f0a41249effc1b6aae0e871e460 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 15:22:55 -0500 Subject: [PATCH 16/20] docs(upgrade-project): drop extra STATICFILES_DIRS --- docs/upgrade-project.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/upgrade-project.md b/docs/upgrade-project.md index 73844969..ef26b3fc 100644 --- a/docs/upgrade-project.md +++ b/docs/upgrade-project.md @@ -41,25 +41,32 @@ Verify project name is compatible with Django 3.2. > **Important** > Failure to do this can crash an entire page. +4. In `taccsite_cms/custom_app_settings.py`, remove project from `STATICFILES_DIRS`, i.e. + + | | change | + | - | - | + | from | `STATICFILES_DIRS = ('taccsite_custom/custom_project_dir', ...)` | + | to | `STATICFILES_DIRS = (...)` | + ### Update Custom Apps Update project apps to be meet Django expectations. -1. In `/custom_project_dir/Dockerfile`, move apps to `taccsite_cms`, i.e. +1. In `Dockerfile`, move apps to `taccsite_cms`, i.e. | | change | | - | - | | from | `COPY /src/apps /code/apps` | | to | `COPY /src/apps /code/taccsite_cms/apps` | -2. In `/custom_project_dir/docker-compose.dev.yml`, sync apps in `taccsite_cms`, i.e. +2. In `docker-compose.dev.yml`, sync apps in `taccsite_cms`, i.e. | | change | | - | - | | from | `- ./src/apps:/code/apps` | | to | `- ./src/apps:/code/taccsite_cms/apps` | -3. In `/custom_project_dir/taccsite_cms/custom_app_settings.py`, remove apps from `STATICFILES_DIRS`, i.e. +3. In `taccsite_cms/custom_app_settings.py`, remove apps from `STATICFILES_DIRS`, i.e. | | change | | - | - | From d5fc99c2b217bffbdb9d6b8ab15d232cfa4527fe Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 15:28:54 -0500 Subject: [PATCH 17/20] chore: whtiespace tweak --- .../templates/custom_example/custom_example.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example_cms/src/apps/custom_example/templates/custom_example/custom_example.html b/example_cms/src/apps/custom_example/templates/custom_example/custom_example.html index 93902fc3..72eaac03 100644 --- a/example_cms/src/apps/custom_example/templates/custom_example/custom_example.html +++ b/example_cms/src/apps/custom_example/templates/custom_example/custom_example.html @@ -1,4 +1,5 @@ {% extends "base.html" %} + {% block content %} This page will contain custom content. -{%endblock %} +{% endblock %} From 9b56704cf437c05896a1962ea8f35e7b17044a39 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 16:10:37 -0500 Subject: [PATCH 18/20] refactor(example-cms): undo unnecessary changes --- docs/upgrade-project.md | 24 +++++++------------ example_cms/Dockerfile | 2 +- example_cms/docker-compose.dev.yml | 2 +- example_cms/src/apps/custom_example/apps.py | 5 ---- .../custom_example/custom_example.html | 5 ---- .../__init__.py | 0 example_cms/src/apps/example_app/apps.py | 5 ++++ .../static/example_app/css/example_app.css | 3 +++ .../templates/example_app/index.html | 13 ++++++++++ .../{custom_example => example_app}/urls.py | 2 +- .../{custom_example => example_app}/views.py | 2 +- .../src/taccsite_cms/custom_app_settings.py | 2 +- example_cms/src/taccsite_cms/urls_custom.py | 2 +- 13 files changed, 35 insertions(+), 32 deletions(-) delete mode 100644 example_cms/src/apps/custom_example/apps.py delete mode 100644 example_cms/src/apps/custom_example/templates/custom_example/custom_example.html rename example_cms/src/apps/{custom_example => example_app}/__init__.py (100%) create mode 100644 example_cms/src/apps/example_app/apps.py create mode 100644 example_cms/src/apps/example_app/static/example_app/css/example_app.css create mode 100644 example_cms/src/apps/example_app/templates/example_app/index.html rename example_cms/src/apps/{custom_example => example_app}/urls.py (81%) rename example_cms/src/apps/{custom_example => example_app}/views.py (74%) diff --git a/docs/upgrade-project.md b/docs/upgrade-project.md index ef26b3fc..d40c81c8 100644 --- a/docs/upgrade-project.md +++ b/docs/upgrade-project.md @@ -48,31 +48,23 @@ Verify project name is compatible with Django 3.2. | from | `STATICFILES_DIRS = ('taccsite_custom/custom_project_dir', ...)` | | to | `STATICFILES_DIRS = (...)` | -### Update Custom Apps + > **Note** + > [Core CMS] already defines the `static` directory for each project. -Update project apps to be meet Django expectations. +### Update Settings -1. In `Dockerfile`, move apps to `taccsite_cms`, i.e. +Remove unnecessary settings. - | | change | - | - | - | - | from | `COPY /src/apps /code/apps` | - | to | `COPY /src/apps /code/taccsite_cms/apps` | - -2. In `docker-compose.dev.yml`, sync apps in `taccsite_cms`, i.e. - - | | change | - | - | - | - | from | `- ./src/apps:/code/apps` | - | to | `- ./src/apps:/code/taccsite_cms/apps` | - -3. In `taccsite_cms/custom_app_settings.py`, remove apps from `STATICFILES_DIRS`, i.e. +1. In `taccsite_cms/custom_app_settings.py`, remove apps from `STATICFILES_DIRS`, i.e. | | change | | - | - | | from | `STATICFILES_DIRS = ('apps/custom_example', ...)` | | to | `STATICFILES_DIRS = (...)` | + > **Note** + > Django automatically identifies the `static` directory for each app. + [Core CMS]: https://github.com/TACC/Core-CMS diff --git a/example_cms/Dockerfile b/example_cms/Dockerfile index ad1fb126..1f34d4cd 100644 --- a/example_cms/Dockerfile +++ b/example_cms/Dockerfile @@ -3,6 +3,6 @@ FROM taccwma/core-cms:cc3e729 WORKDIR /code -COPY /src/apps /code/taccsite_cms/apps +COPY /src/apps /code/apps COPY /src/taccsite_custom /code/taccsite_custom COPY /src/taccsite_cms /code/taccsite_cms diff --git a/example_cms/docker-compose.dev.yml b/example_cms/docker-compose.dev.yml index 4237a950..5663fe54 100644 --- a/example_cms/docker-compose.dev.yml +++ b/example_cms/docker-compose.dev.yml @@ -8,7 +8,7 @@ services: container_name: core_cms hostname: core_cms volumes: - - ./src/apps:/code/taccsite_cms/apps + - ./src/apps:/code/apps - ./src/taccsite_custom:/code/taccsite_custom - ./src/taccsite_cms/custom_app_settings.py:/code/taccsite_cms/custom_app_settings.py - ./src/taccsite_cms/urls_custom.py:/code/taccsite_cms/urls_custom.py diff --git a/example_cms/src/apps/custom_example/apps.py b/example_cms/src/apps/custom_example/apps.py deleted file mode 100644 index 672181cf..00000000 --- a/example_cms/src/apps/custom_example/apps.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.apps import AppConfig - - -class CustomExampleConfig(AppConfig): - name = 'custom_example' diff --git a/example_cms/src/apps/custom_example/templates/custom_example/custom_example.html b/example_cms/src/apps/custom_example/templates/custom_example/custom_example.html deleted file mode 100644 index 72eaac03..00000000 --- a/example_cms/src/apps/custom_example/templates/custom_example/custom_example.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -This page will contain custom content. -{% endblock %} diff --git a/example_cms/src/apps/custom_example/__init__.py b/example_cms/src/apps/example_app/__init__.py similarity index 100% rename from example_cms/src/apps/custom_example/__init__.py rename to example_cms/src/apps/example_app/__init__.py diff --git a/example_cms/src/apps/example_app/apps.py b/example_cms/src/apps/example_app/apps.py new file mode 100644 index 00000000..1016a269 --- /dev/null +++ b/example_cms/src/apps/example_app/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ExampleAppConfig(AppConfig): + name = 'apps.example_app' diff --git a/example_cms/src/apps/example_app/static/example_app/css/example_app.css b/example_cms/src/apps/example_app/static/example_app/css/example_app.css new file mode 100644 index 00000000..dda2cdf8 --- /dev/null +++ b/example_cms/src/apps/example_app/static/example_app/css/example_app.css @@ -0,0 +1,3 @@ +h1 { + color: green; +} diff --git a/example_cms/src/apps/example_app/templates/example_app/index.html b/example_cms/src/apps/example_app/templates/example_app/index.html new file mode 100644 index 00000000..1d46c708 --- /dev/null +++ b/example_cms/src/apps/example_app/templates/example_app/index.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} +{% load static sekizai_tags %} + +{% block content %} + +{% addtoblock "css" %} + +{% endaddtoblock %} + +

Example App

+

Example application content.

+ +{% endblock %} diff --git a/example_cms/src/apps/custom_example/urls.py b/example_cms/src/apps/example_app/urls.py similarity index 81% rename from example_cms/src/apps/custom_example/urls.py rename to example_cms/src/apps/example_app/urls.py index 7ba58e04..d3a292c9 100644 --- a/example_cms/src/apps/custom_example/urls.py +++ b/example_cms/src/apps/example_app/urls.py @@ -2,7 +2,7 @@ from .views import AddedView -app_name = 'custom_example' +app_name = 'example_app' urlpatterns = [ re_path('', AddedView, name='index'), ] diff --git a/example_cms/src/apps/custom_example/views.py b/example_cms/src/apps/example_app/views.py similarity index 74% rename from example_cms/src/apps/custom_example/views.py rename to example_cms/src/apps/example_app/views.py index 985d9732..4e1e16ec 100644 --- a/example_cms/src/apps/custom_example/views.py +++ b/example_cms/src/apps/example_app/views.py @@ -5,5 +5,5 @@ def AddedView(request): - template = loader.get_template('custom_example/custom_example.html') + template = loader.get_template('example_app/index.html') return HttpResponse(template.render({}, request)) diff --git a/example_cms/src/taccsite_cms/custom_app_settings.py b/example_cms/src/taccsite_cms/custom_app_settings.py index 3ac04c50..f194c465 100644 --- a/example_cms/src/taccsite_cms/custom_app_settings.py +++ b/example_cms/src/taccsite_cms/custom_app_settings.py @@ -1,3 +1,3 @@ -CUSTOM_APPS = ['apps.custom_example'] +CUSTOM_APPS = ['apps.example_app'] CUSTOM_MIDDLEWARE = [] STATICFILES_DIRS = () diff --git a/example_cms/src/taccsite_cms/urls_custom.py b/example_cms/src/taccsite_cms/urls_custom.py index 7856c50a..96f4dd39 100644 --- a/example_cms/src/taccsite_cms/urls_custom.py +++ b/example_cms/src/taccsite_cms/urls_custom.py @@ -1,5 +1,5 @@ from django.urls import path, include custom_urls = [ - path('custom_example/', include('apps.custom_example.urls', namespace='custom_example')), + path('example_app/', include('apps.example_app.urls', namespace='example_app')), ] From 99d55c3fb55380d3a29b4c688139293ff2cadc6e Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 16:21:31 -0500 Subject: [PATCH 19/20] docs(upgrade-project): add "Move Images" And make minor fixes. --- docs/upgrade-project.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/upgrade-project.md b/docs/upgrade-project.md index d40c81c8..9ecee267 100644 --- a/docs/upgrade-project.md +++ b/docs/upgrade-project.md @@ -4,7 +4,8 @@ - [Core-CMS v3.11 to v3.12](#core-cms-v311-to-v312) 1. [Rename Project](#rename-project) - 2. [Update Custom Apps](#update-custom-apps) + 2. [Update Settings](#update-settings) + 3. [Move Images](#move-images) ## [Core CMS] v3.11 to v3.12 @@ -12,7 +13,7 @@ Verify project name is compatible with Django 3.2. -1. If you project directory name has dashes, rename it to use underscores, i.e. +1. If your project directory name has dashes, rename it to use underscores, i.e. | | root | | - | - | @@ -68,3 +69,17 @@ Remove unnecessary settings. [Core CMS]: https://github.com/TACC/Core-CMS + +### Move Images + +Verify project name is compatible with Django 3.2. + +1. Remove any subdirectories of your project's static `img` directory, i.e. + + | | root | + | - | - | + | from | `taccsite_custom/static/custom_project_dir/img/*/...` | + | to | `taccsite_custom/static/custom_project_dir/img/...` | + +2. Rename **all** references to the previous image paths e.g. + - in `settings_custom.py` From 8acf98368673ba33e5fc824943fe52ea45fab517 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Sep 2023 16:22:30 -0500 Subject: [PATCH 20/20] docs(upgrade-project): move aliases to bottom --- docs/upgrade-project.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/upgrade-project.md b/docs/upgrade-project.md index 9ecee267..2258a090 100644 --- a/docs/upgrade-project.md +++ b/docs/upgrade-project.md @@ -66,10 +66,6 @@ Remove unnecessary settings. > **Note** > Django automatically identifies the `static` directory for each app. - - -[Core CMS]: https://github.com/TACC/Core-CMS - ### Move Images Verify project name is compatible with Django 3.2. @@ -83,3 +79,7 @@ Verify project name is compatible with Django 3.2. 2. Rename **all** references to the previous image paths e.g. - in `settings_custom.py` + + + +[Core CMS]: https://github.com/TACC/Core-CMS