This is very similar to How to run/view web pages in the IDE, but with a couple minor tweaks and nuances.

With the latest release of the IDE, there is now a shortcut command for booting up a CGI enabled server that is accessible from the web!

All you have to do is run the following in a terminal:

srv-cgi

This will create a cgi-bin directory in your home directory if it doesn't already exist, which will then be served on port 80 of your IDE instance. This is accessible by clicking the globe icon in the toolbar of the files tree:

or the Port 80 menu option under the View menu:

Let's drop a basic CGI script in that directory for python (let's call it hello.py ):

#!/usr/bin/env python3
print("Content-Type: text/html\n")
print("<html><body><h2>Hello World!</h2></body></html>")

Now, if you go to port 80 of your instance, and navigate to /cgi-bin/hello.py
You should see something like this:


You can add more CGI scripts to that directory, or edit this script, and you can just reload the page to see the changes!

To close the server, go back to the terminal and hit ctrl+c to cancel execution.

Remember that you can add whatever you'd like to that directory, and that it works just like a normal CGI server!

Did this answer your question?