-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(example): improve example app, add upgrade doc (#177)
* feat(example): core-cms v3.11.3 * chore: move e-mail settings to same spot * chore: move all images to /img, no child dirs * test: remove elasticsearch.yml (core-cms has it) * chore: set TACC_CORE_STYLES_VERSION = 2 So new projects use v2! Migrated projects, they need to be checking every setting. * feat(example): core cms v3.12.0-beta.3 * chore: try to clean up diff * chore: extra new line (for consistency) * 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. ``` * fix: upgrade for Core-CMS v3.12 (i.e. Django 3.2) * feat: new upgrade path to Core-CMS v3.12 * docs(port-project): small improvements * docs(upgrade-project): add "Rename Project" And make some small fixes. * docs(upgrade-project): refactor "Rename Project" * docs(develop-project): apps are moved * docs(upgrade-project): drop extra STATICFILES_DIRS * chore: whtiespace tweak * refactor(example-cms): undo unnecessary changes * docs(upgrade-project): add "Move Images" And make minor fixes. * docs(upgrade-project): move aliases to bottom
- Loading branch information
1 parent
8912a69
commit 2cdc59f
Showing
17 changed files
with
131 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Upgrade Project | ||
|
||
## Table of Contents | ||
|
||
- [Core-CMS v3.11 to v3.12](#core-cms-v311-to-v312) | ||
1. [Rename Project](#rename-project) | ||
2. [Update Settings](#update-settings) | ||
3. [Move Images](#move-images) | ||
|
||
## [Core CMS] v3.11 to v3.12 | ||
|
||
### Rename Project | ||
|
||
Verify project name is compatible with Django 3.2. | ||
|
||
1. If your project directory name has dashes, rename it to use underscores, i.e. | ||
|
||
| | 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 names. | ||
|
||
3. Identify, support and deprecate old CMS template paths. | ||
|
||
Follow [Port Project: Old CMS Template paths](./port-project.md#old-cms-template-paths). | ||
|
||
> **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 = (...)` | | ||
|
||
> **Note** | ||
> [Core CMS] already defines the `static` directory for each project. | ||
### Update Settings | ||
|
||
Remove unnecessary settings. | ||
|
||
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. | ||
### 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` | ||
|
||
<!-- Link Aliases --> | ||
|
||
[Core CMS]: https://github.com/TACC/Core-CMS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
example_cms/src/apps/custom_example/templates/custom_example/custom_example.html
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ExampleAppConfig(AppConfig): | ||
name = 'apps.example_app' |
3 changes: 3 additions & 0 deletions
3
example_cms/src/apps/example_app/static/example_app/css/example_app.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1 { | ||
color: green; | ||
} |
13 changes: 13 additions & 0 deletions
13
example_cms/src/apps/example_app/templates/example_app/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends "base.html" %} | ||
{% load static sekizai_tags %} | ||
|
||
{% block content %} | ||
|
||
{% addtoblock "css" %} | ||
<link rel="stylesheet" type="text/css" href="{% static 'example_app/css/example_app.css' %}"> | ||
{% endaddtoblock %} | ||
|
||
<h1>Example App</h1> | ||
<p>Example application content.</p> | ||
|
||
{% endblock %} |
3 changes: 2 additions & 1 deletion
3
example_cms/src/apps/custom_example/urls.py → example_cms/src/apps/example_app/urls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from django.urls import re_path | ||
from .views import AddedView | ||
|
||
app_name = 'custom_example' | ||
|
||
app_name = 'example_app' | ||
urlpatterns = [ | ||
re_path('', AddedView, name='index'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
CUSTOM_APPS = [] | ||
CUSTOM_APPS = ['apps.example_app'] | ||
CUSTOM_MIDDLEWARE = [] | ||
STATICFILES_DIRS = () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from django.urls import path, include | ||
|
||
custom_urls = [] | ||
custom_urls = [ | ||
path('example_app/', include('apps.example_app.urls', namespace='example_app')), | ||
] |
File renamed without changes.
File renamed without changes