flask - path doesnt exist but same error still occur [closed] - python

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I get the following error when I run my app.py file
127.0.0.1 - - [05/Jan/2021 15:26:32] "GET /img/chesspieces/wikipedia/wP.png HTTP/1.1" 404 -
I made a complete new path that contains my PNG's and non of my files contains the keyword wikipedia. But I still get the same error, even though non of my files has nothing to do with that keyword. All my files are installed locally on my computer.
I tried rebooting my PC multiple times, create a new virtual enviroment for my app.py, install all dependicies again, and the error still keep occuring. Im using Visual Studio Code. Any ideas how to solve this problem?

Maybe some other application is accessing the flask application. Try changing the port.
app.run(debug=True,port=5000)

Related

Pytest randomly return ConnectionError [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed yesterday.
Improve this question
I have a Django project with pytest as the unit testing module. Previously, everything ran smoothly but lately when running unit testing, it took a very long time, around 20 minutes (initially it only took 10-12 minutes). In addition, there is a test failure that displays the following message:
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')).
Is there any information on how to solve this?
I have tried running unit tests for my entire codebase, but I am seeing errors occur in random files. When I try to run tests for a specific file, the errors occur in random functions within that file.
I also deleted my virtual environment folder and reinstalled my dependencies, and rebooted my computer. However, I am still encountering the same issues with my unit tests. I have tried searching for solutions online, but I am not finding any helpful results with my search keywords

Localhost:5000 always hosting, Flask React [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I have a really weird problem, I am working on a simple flask/react app, hosted normally on localhost:5000 by flask. Everything was working fine until I closed the terminal application and for some reason the server kept on running, now everytime i go to localhost:5000 the application seems to respond and shows me the react landing page, whether or not i am purposefully running the server. Is there some way to find the source of this or just to turn off all servers? I tried rebooting my laptop but the site seems to stay up, I havent changed any of my start up settings, i have no idea why it would turn on at startup.
It's possible that your browser is caching your React landing page, so the only possible solution I can think of is to clear your cache. There are numerous tutorials for this depending on your browser.

Python not working in web browser [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am not able to execute python files in web browser but file can be executed from SHELL terminal.
For Example:
I have created a file under public_html/index.py with following code
#!/home/explore/bin/python
print "Content-Type: text/html\n"
print "Hello World!"
But when I am opening this file in browser, its just coming in simple TEXT.
Note: The index.py file is working fine, When I am trying to run this file by giving absolute path for both files in SHELL terminal using following command
Error: /home/explore/bin/python index.py This gives me error file not found
Correct: /home/explore/bin/python /home/explore/public_html/index.py Works nicely in shell terminal
Please Help, and tell what should i do?
it's normal. The browser don't understand your python file. A browser can handle JavaScript, HTML, ... but no python files. This is why you will have plaintext file.
You need to create an HTTP server that will handle the python file.
You can check around: apache2 and mod_python, django (which is a framework written in python).
Another way would be to write your own HTTP Server in python and connect to it through the browser.
Then you can implement whatever you like. Try to do it by searching : "Python http server" in goodle. There is million of tutorials and guides on the web for that.
Have a nice day.
Kursion
Ressources:
Django guides:
https://docs.djangoproject.com/en/dev/intro/install/
http://hackercodex.com/guide/python-install-django-on-mac-osx-lion-10.7/
http://mirkobonadei.wordpress.com/2010/01/25/install-python-and-django-on-windows/
and so on

How do I keep Django running on on my web server? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am using dreamhost, and just finished a (as far as I can tell) successful installation of DJango on my VPS using Passenger.
Everything was installed from the shell via SSH - and I even launched the server using the command: python manage.py runserver 0.0.0.0:8888
There are 2 issues I am having with this:
Issue 1 (minor)
I have to access my domain at example.com:8888 - though I assume this could be fixed with some URL rewriting - yeah?
Issue 2 (relatively major)
As soon as I kill the terminal (ending my session) my site becomes inaccessible - how do I keep that from happening?
runserver is intended for development, not production. For running production Django applications on Dreamhost, see the Django page on their wiki.
Dreamhost doesn't allow long running processes, they are killed off quite aggressively, you will have to run it on a per connection basis using Passenger WSGI.

Why my Django server not work suddenly? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am woking on Ubuntu 12, python2.6 and Django1.2.x which is my test server.
And I run a Django project on my test server using below command:
python manage.py runserver 0.0.0.0:8000
The server can work for most time(I let it run on 7X24 for other teammate to access it), but sometime it would suddenly not work:
Browser shows me that "server not available" when I try to access it.
And of course, the test server cannot get any request from my frontend, and no error throws on server side.
All will back to OK once I using my django project and run it again.
now I have 2 question:
Why does this issue happend?
How can I develop a shell script to detect this situation?
Actually, it looks like you're trying to use Django development for production purposes. There may be a lot of explanations, like apparmor config, or limitation of single-threaded server, but the problem doesn't worth investigating. Just install Apache2, or Nginx, or uwsgi, and that's it, you have good and stable server without shell watchdogs and other kludges. It would probably take about the same time as posting to SO

Categories