Displaying Python on the Internet

  • Context: Python 
  • Thread starter Thread starter wScott
  • Start date Start date
  • Tags Tags
    Internet Python
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
8 replies · 3K views
wScott
Messages
87
Reaction score
0
Can someone tell me how you would apply python to a web document. Like add the python code to a geocities.com account?
I'd like to know that I can publish Python for all to see :smile:
 
Physics news on Phys.org
Many people use Python on websites, but the Python is running on the server, not on the client. You can use Python to make a page dynamic (perhaps it changes everytime you view it, like this forum).

Unfortunately, geocities (and other free webspace providers) won't let you run your own custom-written programs on their servers, since it would constitute a security risk.

My suggestion, if you're willing to do a bit of learning, is actually to install your own webserver, and serve your own site from your own PC. You can install apache (a webserver) and modpython (the plugin which allows apache to run Python programs) even on a Windows machine, I believe.

If you want to show your dynamic, Python-powered website to the world, there are some subtleties -- for example, if your IP address changes often, you'd have to use a dynamic DNS service.

However, wScott, I strongly recommend that you don't start your career in Python by trying to develop web software. Instead, I suggest you start with command-line programs, then work your way up to desktop GUI programs, then move on to web applications.

- Warren
 
Well Chroot, to answer your first post I wasn't thinking of making a big impact or whatever just making my website more dynamic, like you said, by adding things like input output and things like that.

To answer your second post, I have indeed downloaded it and I'm going through it a little at a time, going through the examples they show me in the tutorials and trying my own things. By the way, do you think it would be a good idea to take notes from the tutorials and putting them in a notebook while I work through it?

EDIT: On the website it shows Python as an Object Object Oriented programming language, yet I haven't run into what I expected, not like the microsoft visual basic I'm being taught in school.
 
Last edited:
wScott said:
Well Chroot, to answer your first post I wasn't thinking of making a big impact or whatever just making my website more dynamic, like you said, by adding things like input output and things like that.

Well, as I said, you'll need more than just a goecities account to do web stuff with Python (or any other language), unfortunately.

EDIT: On the website it shows Python as an Object Object Oriented programming language, yet I haven't run into what I expected, not like the microsoft visual basic I'm being taught in school.

Python indeed has very powerful (and syntactically clean) object orientation. However, unlike other OO languages like Java, there's no obligation to use object orientation. Your first programs will probably be more like scripts. What were you expecting?

- Warren
 
To be honest I don't know hwta I was expecting the first time I downloaded it. I guess a bit like MS Visual Basic :p.

Out of curiosity, if I made like a test site from notepad could I put my Python into that to test it out?
 
Python is pretty far removed from Visual Basic. Given a choice between the two, Python is a much more powerful and widely accepted language.

Again, the only way to get Python in a website is to have access to a web server which you can use to run your Python code. The output from your Python code would then be sent to the client's web browser. You can't embed Python in a web page itself, because web browsers cannot execute Python.

If you'd like, you can install apache on your local computer, then run your Python programs through it. You're going to need full access to some webserver, either your own or someone else's, to run Python-based web applications.

I can guide you through the installation if you need me to.

- Warren
 
If you only want to develop web applications then you have the choice of Python, PHP, ASP/ASP.NET, JSP, CGI, etc.. There's plenty, PHP arguably being the most popular.
I went to Geocities and i saw that of the two packages "Plus" and "Pro", "Plus" doesn't support any server-side technology, but "Pro" has support for PHP and CGI and provides you with MYSQL database.
CGI programs can be built with any language, C, JAVA, Python... So you have plenty of options here if you get the "Pro" package.
From a web development perspective i would recommend PHP over python running as CGI because PHP is built for web development, and is supported across more web hosts, and because i magine there is some overhead in running an application as CGI rather than on a server running the appropriate server extension. But either one will accomplish what you want to do.