Flask/React App in Ignition?

Hi, I am hoping that someone with experience can guide me. I am a co-op student at an automation company, and we are slowly transitioning to Ignition as whole. I am new to Ignition but I have some experience making flask and react apps.

Now, my task is to create a website in Ignition, we have an existing site which is pretty old(made in c++), and we want to transition it to Ignition. I did the inductive university courses, and started designing some stuff in the Perspective section, turns out there's a webdev module, and now I am using that.

So, can someone please guide me as to how I can structure the project and files, and can I use vs code(I am more comfortable in it) to first create a react/flask app and then somehow deploy it in ignition?

Apologies for the yap, and please be gentle with the replies, and thanks for any help :melting_face:

It is technically possible, I suppose, to create a WSGI shim with the WebDev module. I would not consider it appropriate for delivery to a client, though. (As in, an industrial client that received such a solution instead of a bog-standard Perspective solution could be expected to be seriously [expletive] off.)

Your React experience will greatly help you to understand how Perspective components work--consider applying your experience there.

Firstly, Thank you for the very quick response. The website I need to build is static, and after discussing it with my colleagues who work in Ignition, they confirmed that this approach is fine.

The website is sort of an intranet website for the company, with some content and some links to downloadable files. Other than that there's nothing fancy going on, so that's why I want to use react/flask, or just pure HTML/CSS and some JS to build it, would you still recommend doing it in perspective?

No, static content like that can be developed any way you like, and is perfectly appropriate to serve with WebDev. Personally, I would recommend your favorite static site generation tool, like MkDocs or similar, where the source content is in git. The output of the tool would then be placed in a gateway folder that is then made a "mounted" resource in WebDev.

Such static content can also be served by a reverse proxy placed in front of Ignition--avoiding the need for the WebDev $$ module and providing more flexibility in URL schemes.

3 Likes

Thanks for the reply. I don't want to use a static website generator, I want to code it from scratch, and regarding the gateway and the mounted folder (I had to google what that means) I will surely look more into it. Side note: the website is going to be hosted on an internal private server.

As for the reverse proxy, I don't think I will need it cause the website is the only thing that's going to be running on the server, and I don't want to make it any more complex or spend any more resources on it. The reason I want to do it in ignition (webdev) is solely cause my colleagues would prefer that.

Last question, Is it feasible to use a mounted folder to host my React/Flask application, effectively serving the website from that location?

Understood, but I think your end-users will be unhappy with embedded Flask. IMNSHO.

React, yes (as static files). Flask, no.

Flask requires a WSGI shim for knowledge of the full request/response process.

So, my 2 options are use react and a mounted folder, or use basic html/css on the webdev module.

I am gonna go with option number 2, sounds simpler and I shouldn't have any problems.

Thanks for your help (or is it better to do React with a mounted folder :melting_face: )

I would use a static site generator with a WebDev mounted folder. :man_shrugging:

2 Likes

Okiee, thanks!

Consider standing up minimal content with each approach and ask your peers (and perhaps your clients) to critique the approaches.

1 Like

Why are they moving over to igntion if all you are going to do is webdev?
Sure you can make a perfect page in react/js. But why do you need ignition then?

Note i have a webdev background and have used various methods to inject Js and CSS into a normal perspective page, but thats something different than not using perspective at all anymore.

2 Likes

I don't kind of, but I do cause it would put all the companies project in ignition and that would make it easier for them to manage, rather than me developing it in vs and deploying somewhere else.

I did, I have created this for now. I am also gonna let them upload content so it can dynamically render it (that's gonna be another problem, i know how to do it normally, if its the same in ignition then Yipee, other wise we will figure it out)

Now that's a website.

2 Likes

ah so they have igntion already and want their website in it too? i guess than its oke if they agree to it

So you want to use Ignition as a web server right? Do you intend to use data base and backend logic or Ignition historical or real time tags data or you just want to host static web pages? Though it's going to save you some time and effort compared to using a separate server like NodeJS with its own database, but that's not the purpose of a SCADA package like ignition and it may affect its performance. Can you clarify the objective of your application.

Yeah, that's the case

Its' going to be just a static page, serving static content, it will have a database cause one of the feature's is uploading files, and then rendering them on their respective page, so other's can view and download it.

I understand that ignition isn't normally used for this, and this might affect it's performance but I don't think its going to be too much, cause it's mostly static content and not a lot going on.

As for my application, it's an intranet website so different department can view their resources, and download them, with some content such as company news, or upcoming events.

This part probably should be done in Perspective.

Why is that?