WebDev - Run from folder

So I’m hoping to ditch the Mobile Client module in favor of the WebDev module, currently working on a proof of concept to derive development time estimations from and to plot out a bit of a roadmap.

The big question on my mind is whether or not we’ll be able to point the WebDev module at a directory that we can just version with git, would make collaborating and feature development so much easier. Additionally I would be able to ditch the designer almost completely expect when I need to modify tags.

Sure. Just write your Python scripts outside the Ignition designer in your favorite text editor or IDE and then call them inside the Ignition designer. Information about how to do that is here: perfectabstractions.com/blog … on-modules

Use and version control a directory under C:\Program Files\Inductive Automation\Ignition\user-lib\pylib

Best,

hate to just jump in but the webdev module sounds interesting, but way over my head. Can you grab tag values directly from ignition and display them in a webpage? I am assuming you could also query the database. how does that work,? do you have to make the connection thru the Ignition gateway or do you setup the connection directly in python? I looked at the manual but it doesnt give any examples and Im just not sure what the use case would be for the module. If its something you could interface with tags and the database and perhaps build a more “fluid” mobile website, or even alternative html frontend as opposed to using java, that would be interesting.

Hi diat,
Let me answer all your questions.

Yes.

The same way as in the rest of Ignition. Use the datasources that have been configured in the Gateway and use the system.db.* query functions to send queries to databases. Look at the examples for any of the query functions in the Ignition User Manual. They are used no differently in WebDev Python scripts.

Accessing tags in WebDev Python scripts is also done the same way as in any other script: using the system.tag.* functions.

Typical Ignition Python scripting, accessing tags, databases, Python user-libraries etc. is the same in WebDev Python scripts.

Yes, that’s what the WebDev module is for. WebDev stands for Web Development.

The WebDev module is for making websites that are served from the Ignition Gateway. The data resources in Ignition such as tags and database connections are available to the Python scripts that you write to generate the webpages and web data feeds etc.

The WebDev module provides documentation for the web resources and functionality that it exposes and gives examples of how to use them.

It does not give examples of how to develop websites and webpages, JSON, Javascript etc. But it really doesn’t need to because there are so many web development learning resources on the Web and in books. For example google searches can be made for tutorials on CSS, HTML, Javascript, JSON, session management, cookies, and the HTTP protocol, including HTTP headers.

Yes, it is! I can’t wait until someone comes along and asks me to build an Ignition-based website!

Best,

yeah sounds really neat. Ill have to look more into it to get a better understanding. It would be awesome to have a few examples of maybe displaying some tags or a table with query results, etc… so those of us that have little knowledge could see some of it in practice and get a better understanding on how to use it in real world application. Maybe one of your next blogs could focus on making use of the webdev module.

BTW, I appreciate the time you take to write the blogs. Pretty cool of you to take time to help others.

Thanks diat. I think it is a great suggestion to write a blog post about the WebDev and give an example or examples. I will find some time for it.

[quote=“nmudge”]Sure. Just write your Python scripts outside the Ignition designer in your favorite text editor or IDE and then call them inside the Ignition designer. Information about how to do that is here: perfectabstractions.com/blog … on-modules

Use and version control a directory under C:\Program Files\Inductive Automation\Ignition\user-lib\pylib

Best,[/quote]

Hi,

This would allow you to version your python scripts. But what about the html css, and js files etc. What the OP wants is to version a folder of his entire web directory without creating files in the WebDev section of his designer project. Is this possible or am I missing something here? Thank you!

[quote=“jerroldlaw”]This would allow you to version your python scripts. But what about the html css, and js files etc. What the OP wants is to version a folder of his entire web directory without creating files in the WebDev section of his designer project. Is this possible or am I missing something here? Thank you![/quote]It’s possible, but you’ll have to write the linkage yourself, in python. The python scripts will be given the URLs the browser requests, which can then serve the static files however you choose.

Hi Phil,

Thanks for your response! I’m just starting to learn python web programming.

How do I give my external scripts the URLs? I’m guessing I will have to write a http server which translates the URL and serve the files? Or do I have to create an individual python file for every page / URL in the designer which redirects the URL to my external python scripts?

By the way, would it be a good idea or even possible to install a web framework (let’s say Pyramid pylonsproject.org/projects/pyramid/about) on the ignition server as well?

So i am trying to something similar to OP, where I have developed a basic HTML app outside of Designer. I have a Project folder with all my .html, .css and .js files in it which i want to copy to the Web Dev directory.

And i don’t quite understand the last couple of posts.

What is the file path to access the Web Dev files in Debian? I thought it would be something like:

Is it even possible to copy over an entire folder, or import a folder through the Designer?

What is the “Add Mounted Folder” option in the Web Dev section of the Designer for? Thought that might be what I wanted but there isn’t any documentation on it.

Thanks

[quote]What is the file path to access the Web Dev files in Debian? I thought it would be something like:

There is no file path access to the WebDev files. The files which you create using the Ignition designer are all in the .proj file and you will not be able to access the files outside the designer.

Yes. This might just be what you want as those were my exact thoughts when I first saw it as well. Just created a mounted folder called ‘project’ for example, and link it to the path of your project folder in your OS (Debian for your case). You can then access your project files with the URL example:8088/main/system/webdev/ … me/project.

The WebDev module is really great once you figure it out!

So i got the mounted folder to work but only when using Designer on the local host of the machine Ignition is installed on.

Which is awesome, because now i can export an HTML app from an app building website and get it running on my gateway in just a few minutes! Only downside is you cannot browse/edit any of the files in the Mounted Folder via Designer. But the Designer was never really very nice to edit the files in the first place i suppose.