Running python for web pages?

I’m writing a utility script that generates a web page - trying out python, but I can’t seem to get the .py file to run via the web. The scripts run via ssh command line, but throw internal server errors when accessed via the web. Is web-visible python possible? Should I just have it a a cron job to run periodically and dump the output to static text file instead?

looks like mod_python may not be kosher in cpanel-land. no worries. will work around with running the script locally instead.

There’s some robust python support on our newer servers, we’d have to get you moved to one of them (similar to the Ruby selector options I used for this Jekyll tutorial. It’s not for the faint of heart but I’m told people can do a lot of slick stuff with it. The server you’re on is one of the last that we don’t run CloudLinux on (which is necessary for the additional Python and Ruby support). Let me know if you want me to shuffle you to a different server (probably coming at some point anyway as we’ll likely look to move all off that server sometime in 2017).

1 Like

Leave Ramones? We’ve been through so much together! If it’s the end of the line of the box, sure - I’d be happy to move whenever is convenient. How does that process work? Update DNS to point to new IP address - any other tweaks needed?

As long as you’re using our nameservers DNS will update automatically. If you’re pointing to IPs through anything else (Cloudflare is a good example of a service that does DNS externally) then yeah you’d have to repoint IPs but if cPanel is already doing the DNS it transfers all that for you. I’ll reach out to you offline and give you details on the new server and schedule the move. I’ll be as sad as you are to see Ramones go!

  1. How do I find out if I have Python (and which version) on the Reclaim server my site is on?

  2. Is there a doc for Python on Reclaim yet?

At this point pretty much all of our shared hosting servers should have the Python App section under the cPanel Software area here:

Users are given a choice of Python versions from 2.7 all the way to 3.5. I haven’t written a guide specifically for Python (I would love someone in the community to since I’m not much of a Python person myself). I wrote one on the Ruby App section using Jekyll awhile back here which has a similar workflow of creating the app and then using the virtual environment it creates to run commands.

1 Like

I have now successfully deployed a Python Flask app here on Reclaim. I wrote a Google doc showing how to do it:

Even if your app is not built with Flask, the steps will probably help you.

3 Likes

Awesome, this will be a huge help to many people I’m sure. Thank you!

1 Like