Apache Python Interworking Problem

Asked 2 years ago, Updated 2 years ago, 20 views

DocumentRoot /home/mint/Documents/Web
<Directory /home/mint/Documents/Web>
 Options +ExecCGI
 AddHandler cgi-script .py
</Directory>

After setting it as above

#!/usr/bin/python3
print('hello world')

You try to run the Python file on the web in a format that keeps failing. I'm using Firefox, but there's only a message asking if I want to keep opening the file as an application, and even if I google the solution, it doesn't come out.

The reason I changed the directory address was because I understood that I was going to link the file in that path, so I changed it to the path I used. I set it to the original path, but it doesn't work the same way. I don't know what the problem is. Please give me some advice.

++ I'm doing it while looking at the life coding tutorial, but in life coding, you use a web text editor called Codeanywhere, and the Apache route is different with that tool. Why is that?

python apache2

2022-09-22 13:55

1 Answers

https://opentutorials.org/module/3357/19789

They want me to modify the contents of the httpd.conf file Did you do it?

#LoadModule cgi_module modules/mod_cgi.so 

Removing the shop.

When it says you're going to open the file I think it's because the server is set up to handle static resources on the path.

Anyway, I found the file in the path, so I don't think the path setting for the file is wrong.

++ Apache route is... Different OSs have different directories for binary management... Even the same OS may vary depending on how you install it (package installation, binary down, direct compilation, etc.). It works if you install it in the place you want and set the path well, so you need to know why it is installed there (if it works well without any special settings, you don't need to pay much attention to the reason why the installation path is different.


2022-09-22 13:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.