Adding a custom HTML page

Is it possible to add a custom HTML page to Octoprint? I would like to create a functionality that:

  • requires only HTML, JS, CSS and no server side logic,
  • requires a full webpage,
  • utilizes existing Octoprint functionality, e.g. read temperatures or extrude now,
  • ideally does not require an additional login, but uses the existing authentication session of Octoprint.

So my plan is to create a new webpage, and let Octoprint to host it from the same origin, and the page call the same backend endpoints that the current Octoprint UI does.

I don't want to set up another webserver just for a simple webpage, so can I create a page that will be served by the Octoprint webserver?

Thanks.

Check out the bottom of the article. This project was looking very promising, but the developer stopped responding to me.

He did however make a custom landing page to connect to 4 virtual instances of octoprint. I was able to get that part working, and it was awesome!!

http://sebastien.andrivet.com/en/posts/installing-multiple-octoprints-raspberry-pi-3-version-2/

If you really want to serve it from OctoPrint's built in server: Not without writing a plugin. If that is an option, take a look at the BlueprintPlugin mixin.

1 Like

Thanks for the link, Brandon. This is a very interesting article, and if I understand correctly the author used Nginx to host that landing page. I'll try that, but I was hoping to find a simpler solution.

Thank you, Gina, I'll check the plugin development docs.

Hi everyone,

I am trying to do something similar to balassy, to have a webpage for calculation of 3D printing costs (I'm unhappy with the existent plugins) in parallel to Octoprint's webpage. I don't need access to Octoprint functionality, just cura_engine and php, and I only need to display one html file.
It is so simple that I find it hard to accept that I need to install nginx or apache2 to get it to work. Can someone please point me in the right direction? Thank you very much.

I don't know if there is a shortcut, but in my opinion you should know something about Flask, MVVM and the Blueprint setup of Flask.

Hello Balassy,

I'm interested also in serving alternative .html pages using the same Apache2 Webserver on my Octoprint's Raspberry PI server.

I wonder if You solved the problem?

I think that an option could be simply knowing where Octoprint's default .html pages are stored in the server, and create there other new ones.

Does anybody know where the root (initial) directory for Octorpint's .html pages is located in the Rapberry PI's filesystem tree?

Unfortunately, in my installation, .conf files are not located in the standard Apache2 location:

Thanks for any help.
eduardmc

OctoPrint does not serve HTML pages - it renders Jinja templates, which turn into HTML in memory. It does not work as a server like you think it is going to, every route on the server has to be registered.

Static assets can be put into static folders for plugins, and the core OctoPrint source and these are served as-is from the static folder. I don't recommend that you edit the installed files in place, since they will be overwritten on updates. Use a blueprint or asset plugin mixin.

The best bet, as set out above is either create a plugin, or use something external such as installing nginx. However, on OctoPi Haproxy is running, not nginx, so you will have to spend some time configuring the two to not conflict once you have installed.