theta360developers / oppkey-ricoh-viewer-demo-basic

Basic RICOH360 Viewer Demo Without Login
Other
0 stars 0 forks source link

Build backend Example with Flask or FastAPI in a separate repo #4

Closed codetricity closed 1 week ago

codetricity commented 1 week ago

Build Python example.

One strategy is to simply put the entire node JavaScript file into ChatGPT or equivalent and ask ChatGPT to translate it to Python. You can then test the code locally with the front-end components in this repo. You need to copy and paste the files and match up the endpoints.

experiment on branch python-experiment.

https://github.com/theta360developers/oppkey-ricoh-viewer-demo-basic/blob/python-experiment/python_experiment.py

One of the problems is that the node server is serving up the ejs file. we need to convert it to the jinja template of flask. You may need to rewrite the viewer.ejs file to use jinja template syntax. I started the process.

https://github.com/theta360developers/oppkey-ricoh-viewer-demo-basic/blob/python-experiment/views/flask_viewer.html

deliverables

  1. new GitHub repo with the Python server code AND the front-end code to show the viewer
  2. run locally at this stage
  3. document status and functionality in README

Using ChatGPT translation, I got this far.

Using Flask with hard-coded contentid

Although I have the contentId hard-coded into the JavaScript, I am passing the entire content_data listing to the page. So, you can either parse it in JavaScript or rewrite the backend to send parsed data to the page.

image

Using Node

image
codetricity commented 1 week ago

closed with e89a3d51f4768604c93b847aa4357db3c5ce90d3