Create your first server-side script
We will create a very simple script that displays the message "Hello World!" in the browser.
- Set-up your template script
- Add the appropriate Python code to display Hello World on the script
The video below will demonstrate how to do this.
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:
- Added the correct path to Python at the top of the script
- Added the appropriate exception handling in the main program
- Checked the syntax of the script in Idle using Run -> Check Module
- Made sure the script is executable on Unix systems
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.
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.
- 1. Introduction to server-side scripting
- 2. Getting ready for server-side scripting
- 3. Preparing for your first script
- 4. Create your first server-side script
- 5. Capturing and processing data
- 6. Processing the form data
- 7. Server-side scripting and databases
- 8. Adding data to a database
- 9. Displaying data from the database
- 10. More on HTML forms
- 11. Pizza Kitchen
- 12. Administration Forms
- 13. Customer Account Form
- 14. Customer Order Form
- 15. Current Orders