Jump to content

Deploying and running Python web app


dmncwrk

Recommended Posts

  • 2 weeks later...
On 11/29/2022 at 9:04 PM, wolstech said:

That documentation is for the old cPanel servers and is obsolete.

That said, the script itself should work if you make the script using the below shebang line (we updated Python) in Plesk's file manager. 

#!/usr/bin/python3.10

 

For some reason Im still struggling with this, could disabled CGI support be the reason?

image.thumb.png.70226db167e65a09850054fd34eb7384.png

 

Also when trying to login to Plesk I see cert error, is that how it is supposed to be?

image.thumb.png.817bab3e0e4b82d2cd916719fcd03131.png

Link to comment
Share on other sites

1. Looks like CGI is disabled in your host. I think you need to enable this in order to do scripting. Please goto Websites  & Domains. Select Settings for your domain and enable CGI support in Web scriptions and statistics section.

2. The reason for your 'Connection is not private' error is that you are using your sub-domain for logging into Plesk account. Though it is technically possible to do that as 8443 port is enabled on the host, since Plesk is hosted and enabled for tommy2.heliohost.org and the same certificate is used when trying to access the Plesk control panel it ends up with an error as your browser sees a tommy2.heliohost.org certificate when it is trying to access it from your subdomain. I believe this does not affect the security of your SSL connection to the server, however it is best to access Plesk login using regular login through tommy2-based URL as it keeps you from getting too comfortable with ignoring this warning when it might really matter.

Link to comment
Share on other sites

3 hours ago, dmncwrk said:

could disabled CGI support be the reason?

There was a mistake in the service plan definitions. For some reason CGI was disabled on the 3000 MB plans, but enabled on the 1000 MB plans, etc. Sorry about that. It's been fixed. Does it work for you now?

3 hours ago, dmncwrk said:

Also when trying to login to Plesk I see cert error, is that how it is supposed to be?

There are two supported ways to log in to Plesk: 1) https://heliohost.org/login/ and 2) https://tommy2.heliohost.org/ any other method probably will give errors or possibly not count your logins and get you suspended for inactivity. The preferred method for logging in is option 1 so you can see the news and other notifications regarding your account.

Link to comment
Share on other sites

3 hours ago, dmncwrk said:

For some reason Im still struggling with this, could disabled CGI support be the reason?

To be honest I've never used Python for web but since you have FastCGI enabled, I don't think it is the problem.

Try to run the following script on your website's "cgi-bin" directory:

#!/usr/bin/python3.10

print("Content-type: text/html") # Send our page's header to webserver

print() # Blank line to end page's header

# Now our page's content below:

print("<html><head><title>Python \"Hello World!\" testing</title></head><body><pre>")

print("Hello World!")
print("Heliohost rules!")

print("</pre></body></html>")

Here's the above script on my website: https://fasouza.eu.org/cgi-bin/test.py

Remember that the file should have chmod (permission) 755, so it has to be like that (I used a FTP program but you can do it on Plesk's file manager):

image.png.5745b96233a371a7ebc295353c9b7955.png

If it doesn't work, then probably it is necessary to enable CGI support. But to be sure we need to know what kind of error are you getting when runing your script (and it would be helpful to also have your logs).

3 hours ago, dmncwrk said:

Also when trying to login to Plesk I see cert error, is that how it is supposed to be?

You're seeing this error because port 8443 has the SSL certificate of "tommy2.heliohost.org". You should access Plesk on https://tommy2.heliohost.org/ or preferably on https://heliohost.org/login/.

Link to comment
Share on other sites

  • 2 weeks later...
On 12/11/2022 at 5:15 AM, Kairion said:

To be honest I've never used Python for web but since you have FastCGI enabled, I don't think it is the problem.

Try to run the following script on your website's "cgi-bin" directory:

#!/usr/bin/python3.10

print("Content-type: text/html") # Send our page's header to webserver

print() # Blank line to end page's header

# Now our page's content below:

print("<html><head><title>Python \"Hello World!\" testing</title></head><body><pre>")

print("Hello World!")
print("Heliohost rules!")

print("</pre></body></html>")

Here's the above script on my website: https://fasouza.eu.org/cgi-bin/test.py

Remember that the file should have chmod (permission) 755, so it has to be like that (I used a FTP program but you can do it on Plesk's file manager):

image.png.5745b96233a371a7ebc295353c9b7955.png

If it doesn't work, then probably it is necessary to enable CGI support. But to be sure we need to know what kind of error are you getting when runing your script (and it would be helpful to also have your logs).

You're seeing this error because port 8443 has the SSL certificate of "tommy2.heliohost.org". You should access Plesk on https://tommy2.heliohost.org/ or preferably on https://heliohost.org/login/.

This works now, thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...