FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How to run python script on web server ?





in4860
I want to run youtube-dl.py on server so as to download youtube videos to my web server for personal use.
anshkathuriaweb
I m also looking for running python script on server
jajarvin
in4860 wrote:
I want to run youtube-dl.py on server so as to download youtube videos to my web server for personal use.


What OS you have Question
Linux or Windows (which version) Question
freepgu
You might move python script to cgi-bin folder on webroot folder and rename to *.cgi, (mypythoncode.cgi)
add the appropriate permissions and browse to it.
For more info please visit below link:
https://docs.python.org/2/howto/webservers.html
amagard
There is actually no need to rename a Python script to *.cgi. It does work with the py extension, see for example: http://www.amagard.frihost.org/cgi-bin/py_eval.py?expr=80+%2F+4&input=None
As long as the web server is configured to accept *.py files as executables this will work. Or if the server uses mod_python.
Important is that the file has execute permissions set.

The article "HOWTO Use Python in the web" describes nicely common problem with Python CGI scripts in chapter "Common problems with CGI scripts".
roshedwardd
Depending on your web server configuration, you may need to save this code with a .py or .cgi extension. Additionally, this file may also need to be in a cgi-bin folder, for security reasons.

You might wonder what the cgitb line is about. This line makes it possible to display a nice traceback instead of just crashing and displaying an “Internal Server Error” in the user’s browser. This is useful for debugging, but it might risk exposing some confidential data to the user. You should not use cgitb in production code for this reason. You should always catch exceptions, and display proper error pages – end-users don’t like to see nondescript “Internal Server Errors” in their browsers.
bpgs
Have you already tried it? Which error message do appear?

Depending on the server configuration it could be necessary to create a .htaccess file containing:

Code:
AddHandler cgi-script .py


But in this case there is a detailed installation guide on
https://github.com/rg3/youtube-dl/blob/master/README.md#installation
korryaldrin
Depending on your web server configuration, you may need to save this code with a .py or .cgi extension. Additionally, this file may also need to be in a cgi-bin folder, for security reasons.
You might wonder what the cgitb line is about. This line makes it possible to display a nice traceback instead of just crashing and displaying an “Internal Server Error” in the user’s browser. This is useful for debugging, but it might risk exposing some confidential data to the user. You should not use cgitb in production code for this reason. You should always catch exceptions, and display proper error pages – end-users don’t like to see nondescript “Internal Server Errors” in their browsers.
jestoy0514
Hi, greetings! How about trying Bottle web framework this may answer your inquiry. It is quite easy to use and very friendly for newbies like me.
Related topics
what is your php mysql apache installer package
KF web server
A good windows version for web server...
python script???
Using Dynamic IP to host a Web Server
How to Set up Local Web Server
Making your XP as Internet Web Server
Windows 2000 advanced as web server?
Making a Web Server
How to install Wordpress on your web server ?
Your Own Computer as web server.
What is the difference between CGI and python script?
Python support?
Problem with python script
Reply to topic    Frihost Forum Index -> Computers -> Computer Problems and Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.