I think you can use mod_cgi with apache and put in the URL of an accessible python file, with the first line of the script
however, this is a VERY inefficient way to access python code, because apache has to reload python every time a page accesses it. Ok for a one-time maintenance script, you only call it from time to time, but it’s not suitable for active content that users access.
Edit: I did not understand that you are on Windows. Something like this should be possible. Try googling python apache cgi .
Edit: if you have apache running in cgi mode, you don't need to restart it every time. If the script is present and executed at the specified URL path, it will be launched. If this is not the case, you will get an error on page 404
Edit: I did a very quick Google search for "python cgi" and found these slides 10 years ago by the creator of Python. They document an outdated version of the language, but slides from the age of 41 may be useful to you. As I said, people have left scripted web applications using this method, but if your requirements are simple, it will still work. http://legacy.python.org/doc/essays/ppt/sd99east/index.htm
Edit: The best approach depends on what you are trying to do. Using a service framework can be useful. I can recommend Web2py as a very reliable and secure environment that will allow you to write scripts and dynamically add them. It has a version of Windows that includes a simple web server, or you can also configure apache. Since everything is inclusive, you can start up within minutes if you read the introductory information. If you have not used web frameworks before and are not familiar with lanugage, for example, the "model view controller", do not delay. http://www.web2py.com/
source share