0

This seems like a problem a lot of folks have.

  1. I completely changed my index.html page. Then saved changes, stopped and re-ran server.py which has the following code:

     from flask import Flask, render_template
     app = Flask(__name__)
    
     @app.route('/')
     def home():
         return render_template('index.html')
    
    
     if __name__ == "__main__":
         app.run(debug=True)
    

I have saved changes, stopped and re-run flask from terminal using >> set FLASK_APP=server.py >> flask run. I have also tried clearing browser cache and retried on multiple browsers. I have tried shift+reload Previously it used to work on completely closing Pycharm and restarting. However even that isn't working anymore.

  1. Apart from displaying text that no longer exists in index.html, the Debugger Console is also showing the following error: 127.0.0.1 - - [22/Jul/2021 17:29:58] "GET /favicon.ico HTTP/1.1" 404 - My pointer to the file location is correct: But just to make sure I copy pasted favicon.ico in every damn folder in the project.

I have tried "save all" on my project several times. Stopped and started debugger several times. Any other solution I left out?

Zubin
  • 69
  • 7
  • Have you checked whether pycharm really saves your file. Open the file in notepad and check. And then run it from system terminal (like cmd) and see If changes occur. – charchit Jul 22 '21 at 12:24
  • Yes it is saving. I checked. I can also run index.html successfully by clicking the browser icon and pycharm icon within Pycharm (on clicking the index.html tab). – Zubin Jul 22 '21 at 12:32
  • I asked you to open system terminal(not pycharm) like cmd in windows in root folder of your app and run flask run. And then visit the page in browser, see if changed you made are are there. – charchit Jul 22 '21 at 12:35
  • I understood what you meant. I ran it in cmd. Debug mode: on * Restarting with stat * Debugger is active! * Debugger PIN: 114-458-599 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) Still browser shows old page. – Zubin Jul 22 '21 at 12:48
  • @ZubinMadon did You reload the browser? – Matiiss Jul 22 '21 at 13:08
  • @ZubinMadon the error is not with Favicon, it is the icon which is shown at top of site. The problem might be that there is a process already running. Have you tried opening task manager and see if any python application is running. – charchit Jul 22 '21 at 13:18
  • @ZubinMadon Try changing the post by giving port parameter in `app.run(port=5500,debug=True)`. If that doesn't work, try restarting your machine and then run the app from cmd. – charchit Jul 22 '21 at 13:27
  • @charchit Tried it. Still shows old page. Went and opened index.html from folder. That loads the new one fine. I dont know why pycharm is stuck with old one. Tried various port numbers. – Zubin Jul 22 '21 at 13:33
  • @charchit is this something to do with windows environment? – Zubin Jul 22 '21 at 13:36
  • Sorry but I don't know because the problem is with your machine and I don't what's happening there. Why don't you just delete the folder and make a new one and try running it. Have you tried switching off your computer? – charchit Jul 22 '21 at 13:44
  • @charchit I can switch off but everytime it is the same issue. Now I found a solution here: https://stackoverflow.com/questions/48198/how-can-you-find-out-which-process-is-listening-on-a-tcp-or-udp-port-on-windows CMD as admin >> netstat -n I see port 5600 shows 12 "foreign addresses" and state shows TIME_WAIT Does that explain anything? – Zubin Jul 22 '21 at 14:03
  • Restaring computer didnt help. – Zubin Jul 22 '21 at 14:36

0 Answers0