I'm trying to do what I thought was straightforward but am discovering is not. I'm hosting a webserver locally on a Raspberry Pi using Django and I want to allow the user to browse to the server, type something in a text box and then have that appended to a file sitting on the Pi.
So far, I have Django displaying a really basic HTML page, but I can't get it to execute any of the functions in my views file and I also don't know if the easiest route here is to work with a POST request and have some function set up to listen and write the contents of that?
You are going to need to write a view that will accept the text the user types into the box and writes it to the file...
def my_view_to_write_to_file(request):
if request.method == "POST":
# put normal python open/write/close stuff here
If you can't seem to get this view to execute than you need to make sure you have your urls correct.