Skip to content

I465 Adding django backend#492

Merged
pushyamig merged 3 commits into
tl-its-umich-edu:developfrom
pushyamig:i465_Django_BE
Jan 14, 2025
Merged

I465 Adding django backend#492
pushyamig merged 3 commits into
tl-its-umich-edu:developfrom
pushyamig:i465_Django_BE

Conversation

@pushyamig

@pushyamig pushyamig commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

Fixes #465

This PR is

  1. Adding Django Backend
  2. Removing all the NodeJS Backend packages from package.json.
  3. Doing the Webpack build from only React code
  4. Using docker Supervisor feature for running FE and BE
  5. README instruction are there. Simply only doing docker compose build and docker compose up
  6. .env file in not place in the project root directory instead in the ${HOME}/secrets/ccm/.env. So create folder /secrets/ccm

The CCM homepage will launch, but for now I added dummy data for the API call when the home page launches. This setup is going to be temporary until be have API integration happens. All the changes can be found in api.ts

This PR does not have

  1. LTI integration, which is next
  2. I haven't setup DockerBuild for running in Prod mode, which I will pause and will look when doing the Openshift setup
  3. You might see a warning saying
    ExperimentalWarning: --experimental-loader may be removed in the future; instead use register()
    That is because CCM migrated to ESM and not commonJS. So in future version of Node commonJS support might be removed.
    node --loader ts-node/esm node_modules/.bin/webpack --config webpack/webpack.dev.ts --watch
    4. More On this can be found here. This is something know during ##330 Upgrade CCM To ESM  #433
  4. I did not remove the NodeJS code w.r.t to BE which is in server. I will remove it in future.

@pushyamig pushyamig changed the title I465 django be I465 Adding django backend Jan 14, 2025
Comment thread requirements.txt
mysqlclient==2.2.6

#Django
Django==5.1.4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Django 5.1 isn't LTS, 5.2 LTS doesn't come out until April. You may want to hold back to Django 4.2 (currently 4.2.18) until later this year unless this isn't going to be released until after April 2025.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel Releasing in Apr is very optimistic. I feel this is going to live in summer. Thats why I chose Django 5 version. I can change to 4 version if you like. LMK

@jonespm jonespm Jan 14, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine based on the release timeline here to leave it 5.1, just that we should update to Django 5.2 before we do release. It should be out in early April. I think this is good progress and we might have this by late April or May.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will keep 5.1 and will upgrade to 5.2 before release. I will create an issue for that.

Comment thread requirements.txt Outdated
django-mysql==4.15.0
django-webpack-loader==3.1.1

debugpy==1.8.8

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be updated to 1.8.11, also might want to check the versions of the other dependencies here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread README.md
using fallbacks when available and throwing an error if required values are not present.
The application will exit if any of the required configuration values are not set properly.

#### Canvas

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think much of this section is still relevant. Might want to break it out the parts that won't change into separate .MD files to make it easier to maintain separately like we did for MyLA in docs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I want to add stuff, based on the implementation. So I did not implement the LTI, Canvas Oauth. So I. removed it for making the PR reviewer just focus on what is there. I will add them back when I am adding features on at a time

Comment thread docker-compose.yml Outdated
- PORT=4000
- NODE_ENV=development
env_file: .env
- DEBUG=True

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found out with ROHQ that you can use this pattern to specify defaults in the docker-compose file

- DEBUG=${DEBUG:-True}

I'd switch to this here for everything in the environment section.

https://github.com/tl-its-umich-edu/remote-office-hours-queue/blob/e329460a143c18fdcaf3dbb24284879a30ebc9c2/docker-compose.yaml#L9

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread docker-compose.yml Outdated
dockerfile: ./Dockerfile
context: .
dockerfile: Dockerfile
args:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the args are needed here anymore.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Removed

@jonespm jonespm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but left a few comments which can be addressed now or in future issues if you just want to move this along. Thanks!

@pushyamig pushyamig mentioned this pull request Jan 14, 2025
@pushyamig

Copy link
Copy Markdown
Contributor Author

This PR Finishes #466,

@jaydonkrooss

Copy link
Copy Markdown
Contributor

Looks good to me, locally ran it with 404 errors on the API, which I assume is expected. I can help with APIs once we move on to that step, just let me know.

@pushyamig

Copy link
Copy Markdown
Contributor Author

Looks good to me, locally ran it with 404 errors on the API, which I assume is expected. I can help with APIs once we move on to that step, just let me know.

Yes, API endpoints are not wired up so those errors are expected. We are progressively building it. This PR is to separate the FE from the Node setup and build using on Webpack and make the Js Dump file main-*.js available via Django Setup. Along with that integrate with Django Ecosystem.

When CCM launch it makes API call, so I have to set up some static JSON response and launching the home page so that It acceptable for this PR.

@pushyamig pushyamig merged commit d0ab54f into tl-its-umich-edu:develop Jan 14, 2025
@pushyamig

pushyamig commented Jan 14, 2025

Copy link
Copy Markdown
Contributor Author

Thanks @jonespm and @jaydonkrooss for the Quick Review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants