Lecture 54:

posted May 10, 2013, 8:25 AM by Samuel Konstantinovich   [ updated May 12, 2013, 11:26 AM ]
Homework for the weekend: Make a basic 'blarg' (info posting / displaying ) website. Then link it to your home.html

You may want to make a sub directory for this:

1. Make a display.py file that displays the contents of a text file

2a. Make a html form that submits a text field to a write.py
2b. Make a write.py file that writes the information to a text file

If you use the local web server you may need the full path to files:
c:\stuff\hi.txt -> '''c:\\stuff\\hi.txt'''

Your end result should be:
data.txt --> a text file that has the data for this assignment. (You should chmod with +w, OR use filezilla to make it write-able)

submit.html --> a form with a text field and a submit button that links to write.py (the action should be write.py)
[optionally place the form inside of the display.py instead of a separate html file]

write.py --> a program that accepts a text field's results and writes that to the end of the text file. [You can use  open(filename,'a') for appending] You may want to add newlines after submitted data. (chmod +x this file)

display.py --> a program that reads the data.txt file and displays the content in html. (chmod +x this file)

Comments