Reputation: 615
I have Flask app, and I wanted to run in pythonanywhere.com. I have followed the links Link1, Link2, couldn't resolve the issue. My flask app name is tourismmining
and the contents of the directory is listed under
My application is structured in the below way.
tourismmining
|-> instance
|-> mining
|-> resources
|-> entry.py
|-> installation.txt
|-> License
|-> Procfile
|-> README.rst
|-> requirements.txt
The core application is in the directory mining
and is structured in the following way
mining
|-> config
|-> db
|-> exceptions
|-> files
|-> forms
|-> logs
|-> models
|-> sink
|-> static
|-> templates
|-> __init__.py
|-> main.py
|-> utils.py
So, just by flask local server, I used to run the below command
cd tourismmining
python -m mining.main
and below is the output
In touristmining, I have written an another file named entry.py, and it contains
from mining import app
if __name__ == '__main__':
app.run(debug=True)
And I run the file entry.py
using the below command
cd tourismmining
python entry.py
Now, after uploading the same code in to pythonanywhere, the directory structure is given below
Setting up the virtual environment and tried two ways of configuring the wsgi file which are given below
import sys
path = '/home/s1782662edin/tourismmining'
if path not in sys.path:
sys.path.insert(0, path)
from mining import app as application
import sys
path = '/home/s1782662edin/tourismmining'
if path not in sys.path:
sys.path.insert(0, path)
from entry import app as application
And reload the website, nothing worked out. Its says
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your
spelling and try again.
Upvotes: 0
Views: 896
Reputation: 5786
Make sure that you have routes defined and that the code for defining the routes is run when app is imported from mining.
Upvotes: 0