Tip
This project is built as a customization of a TACC CMS website. To manage this project's CMS, reference Core-CMS-Template Docs. To develop this project's custom code, keep reading.
-
Navigate to project directory:
This is a CMS that contains a Portal client application.cd to acpd_cms -
Configure the project:
- secrets.py, settings_custom.py, and settings_local on apcd_cms/src/taccsite_cms will be empty directories after cloning the repo. Please delete these directories.
- Create a
/apcd_cms/src/taccsite_cms/secrets.pyfile with content from "Stache" secretAPCD DEV CMS.NOTE: APCD_DATABASE.database should be 'pipeline2' for local development - Create a
/apcd_cms/src/taccsite_cms/settings_custom.pyfile with the following code:# CUSTOM SETTINGS VALUES. # TACC WMA CMS SITE: # *.APCD.TACC.UTEXAS.EDU ######################## # TACC: LOGO & FAVICON ######################## LOGO = [ "tacc", "apcd_cms/img/org_logos/apcd-white.png", "", "/", "_self", "APCD: All-Payer Claims Database", "anonymous", "True" ] PORTAL_FAVICON = { "is_remote": False, "img_file_src": "apcd_cms/img/favicons/favicon.ico", }
- Create a
/apcd_cms/src/taccsite_cms/settings_local.pyfile with the following code:''' A `settings_local.py` file can override default values in `settings.py` and `settings_custom.py`. For a detailed walkthrough on overriding settings, see `settings_custom.example.py`: https://github.com/TACC/Core-CMS/blob/main/taccsite_cms/settings_custom.example.py ''' # Hide error about using Google Recaptcha test keys SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error'] # Disable the Core-Portal integration. INCLUDES_CORE_PORTAL = False INCLUDES_PORTAL_NAV = False
-
Start the CMS website:
This command will also first build the CMS as needed.make start
-
Navigate to client app:
cd apcd_cms/src/client -
Install dependencies:
npm ci
-
Start the client app:
npm run dev
-
Change code and observe updates live in the browser.
-
Update
urls.py:- Make the default page return as
TemplateView.as_view(template_name='<template_name') - Add API endpoints.
These endpoints are used in Client.
- Make the default page return as
-
Update
views.py:importJsonResponse- Remove Template building.
- Adjust context to return
json. - Send
JsonResponse.
-
Define hook:
- Add method to retrieve data from server.
- Add & Export
types inindex.ts.
-
Defining component:
- Add one or more components as a
.tsxfile. - Export the component.
- Add
exports inindex.ts.
- Add one or more components as a
-
Update
apcd_cms/src/client/src/main.tsx:importthe component.- Map (via
componentMap) a unique ID to the component.
-
Update first line:
- from
{% extends "standard.html" %} - to
{% extends "apcd_cms/templates/standard.html" %}
- from
-
Add an element where the component will render e.g.
<div id="list-registrations-root"></div>
Give the element its unique
idas defined inmain.tsx.