Run Julia Programs as Web Applications Without Frameworks Julia Programming | Kovolff
HTML-код
- Опубликовано: 25 авг 2024
- To be able to run your Julia programs as web applications, just implement the steps below:
1. Download and Install Xampp
Xampp is a software which acts as a web server on your local machine
Website:www.apachefrie...
Downloads: www.apachefrie...
2. Download and Install Julia
This is obvious, as without Julia installed, you cannot run any Julia applications
Website: julialang.org/
3. Go to your Xampp folder and then
Xampp / apache / conf / httpd.conf
Any line commencing with # is a comment
4. Add this string to the bottom of the httpd.conf file
AddHandler cgi-script .jl
ScriptInterpreterSource Registry-Strict
This enables Xampp to handle .jl scripts aka your Julia programs.
5. Search in httpd.conf for the following string: IfModule dir_module. You will see a lot of index.xx, home.xx or default.xx elements. Just add index.jl, home.jl and default.jl
This ensures that when you input a url such as localhost/my_webapp/, Xampp will use index.jl as the web application’s home page
6. Lastly you can change the location of your root / public folder. This is the folder where you place your Julia programs for Xampp to serve them as web applications.
Search for the string DocumentRoot. You will see that Xampp uses by default the directory htdocs. You can change that to any other directory on your drive. It does not have to be within the Xampp directory.
7. In your Julia code insert in the first line the path to your Julia installation preceded by #!,
For example: #!C:\Julia\Julia-1.4.0\bin\julia.exe
8. Before you utilize any print statement in your Julia code, ensure that your script outputs HTML. This is done with: println(‘Content-Type: text/html’)
#julia #xampp #learn #programming #apache
how about accepting input from the client, and sessions?
Thank you for this very interesting video!
Glad to hear it :-)
Hi, very helpful! Have you discovered a way to use installed Julia Packages within the CGI scripts? I've tried to follow suggestions for setting env variables like APPDATA, without success. Get LoadError: Argument Error: Package not found...
Using XAMPP, LAMP etc is very good, but there is something like the Flask (from Python) way or the Express (from Node) way to create a Julia server by itself?
Maybe with HTTP.JL or so?
yes exactly, but you can do it without Flask et al ... That was the point of the video
How is julia for making highly concurrent web apps?
Best check the documentation, ie docs.julialang.org/en/v1/manual/parallel-computing/