I am trying to run my website via a XAMPP Apache server over my LAN at home, but after storing my site in XAMPP's HTdocs file, edited the httpd.conf file to include a .py handler and other configuration as directed in this question: Running Python Scripts with XAMPP. Following this I included routes to both python3 and python 2.7 at the tops of my run.py and _init__.py file
#!C:User/path/to/python3.exe
#!C:User/path/to/python2.7.exe
I also have it so that my port configurations in the httpd.conf file are listening at the IP address on port 80 as well and have the server name as the IP address and the port name.
After following all of these steps, when I access the IP address in a separate home computer, python command line opens on the laptop operating as my server and runs my program on localhost:5000 as usual. I need this program to run across my LAN network (just a basic flask website). How can I do this/am I missing a step? Do I need to add the python routes to the top of every one of my files???
Got my answer here: Configure Flask dev server to be visible across the network from @Ibz. Shaikh. They go through command Prompt to set this up. Later on, I was able to figure out that in my run.py file I can set the host name to the IP address that I want.
if __name__=='main__':
app.run(debug=True)
change to
app.run(host=<ip address of your server>)
And it will run on {ip address}:5000 (similar to @Jeevan Chaitanya's answer in the aforementioned link).
If you decide to continue using port 8080 where XAMPP is, make sure that your files are stored accordingly. I had to have my run.py file directly in htdocs (path: C:/xampp/htdocs/run.py)... nesting it further caused errors.
From my original question: No, you do not need to add routes to python at the top of each file. Just ensure that your server (i am working on development and using a laptop to practice) runs python.