Create your first server-side script

We will create a very simple script that displays the message "Hello World!" in the browser.

  1. Set-up your template script
  2. Add the appropriate Python code to display Hello World on the script

The video below will demonstrate how to do this.

Task 1

Create a simple Hello World script by following the video above.

Checking for common mistakes

Now that you have completed your first Python script you are almost ready to upload it to the server. Before you do so check that you have done the following:

  1. Added the correct path to Python at the top of the script
  2. Added the appropriate exception handling in the main program
  3. Checked the syntax of the script in Idle using Run -> Check Module
  4. Made sure the script is executable on Unix systems

Task 2

Check your script for common errors using the advice above.

Uploading and running your script

Having checked for common mistakes it is time to upload the script to your web server. This process is going to vary somewhat depending on how you set-up your server initially.

If you are using XAMPP then follow the instructions below, otherwise follow the instructions given to you during the server-side session you are attending.

In order to run your script you must request it via your web server. Again, the process to do this will vary depending on whether you are using XAMPP or attending a server-side session.

Task 3

Upload the Hello World script to your server.

The videos below demonstrates how to upload and run your script via your XAMPP installation. Click on the video appropriate to your system:

If you are using XAMPP (localhost server) the instruction videos above should be sufficient to help you do this. However, if you are uploading to an actual web server you will have been provided with additional instructions.

Passing data to a script

In the next section you will learn you to pass information to a script using a HTML form.