drifterf
Posts: 89
Joined: Sat Dec 08, 2018 9:09 am
Location: Northants, England

use a webpage to edit areas of a script

Fri Dec 28, 2018 11:38 am

Hi, what i am after is to have a local webpage which can be used to edit parts of a python script easily so its more user friendly.

say for instance for making a led stay on for whatever the user wants. so they could just type in "5" and save or something and it would edit part of the script to modifiy the part needed

Heater
Posts: 12595
Joined: Tue Jul 17, 2012 3:02 pm

Re: use a webpage to edit areas of a script

Fri Dec 28, 2018 11:42 am

Sounds like a really bad idea. Complex too.

Just have your web page save the "5" parameter some place and have the Python script read the value from there and behave accordingly.

drifterf
Posts: 89
Joined: Sat Dec 08, 2018 9:09 am
Location: Northants, England

Re: use a webpage to edit areas of a script

Fri Dec 28, 2018 1:01 pm

Heater wrote:
Fri Dec 28, 2018 11:42 am
Sounds like a really bad idea. Complex too.

Just have your web page save the "5" parameter some place and have the Python script read the value from there and behave accordingly.

hi this sounds good, didnt think of it backwards. any idea where to look for learning how to do this ? any webpage etc would be appreciated, thanks

drifterf
Posts: 89
Joined: Sat Dec 08, 2018 9:09 am
Location: Northants, England

Re: use a webpage to edit areas of a script

Wed Jan 02, 2019 6:43 pm

anyone help with this ?

User avatar
penguintutor
Posts: 376
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Re: use a webpage to edit areas of a script

Thu Jan 03, 2019 10:54 am

Your question is very vague.

What have you created so far? Have you tried searching for some tutorials that can help?

Web Server

Are you running a web server? If so try searching for how to run a script in your webserver and have that script take a value from a form submission and write that to a file.

If you don't already have a web server the you could look at something like Python Bottle or Python Flask which run as a web server within your python code

Reading values from a file

Once you have the values saved into a file then you need to add some code that reads the value from the file and stores it in a variable. There are lots of tutorials around on that.




If you are still struggling then I suggest you provide a more specific post with details of the code you've tried and why it isn't working.

Return to “Python”