my code runs fine in local server, having issue with in here
app.py
from flask import Flask, jsonify, render_template, request
from chat.chat import chatting #shows error here
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/contact')
def contact():
return render_template('contact.html')
@app.route('/resources')
def resources():
return render_template('resources.html')
@app.route('/about')
def about():
print(1)
return render_template('about.html')
@app.post('/predict')
def predict():
text = request.get_json().get("message")
print(chatting(text))
response = chatting(text)
message = {"answer": response}
return jsonify(message)
if __name__ == "__main__":
app.run(debug=True)
/////////////////////////////////////////
2022-11-13 23:42:49,353: File "/home/mp3096/mysite/app.py", line 2, in <module>
2022-11-13 23:42:49,354: from chat.chat import chatting
2022-11-13 23:42:49,354:
2022-11-13 23:42:49,354: File "/home/mp3096/mysite/chat/chat.py", line 11, in <module>
2022-11-13 23:42:49,354: with open('chat/replies.json', 'r') as json_data:
This is my folder struct
mysite->static-> some js images stuff // works fine
mysite->templates-> some webpages //works fine without chat folder
mysite->app.py
mysite->chat->chat.py , model.py, nltk_utils.py, replies.json, train.py
wsgi pythonanywhere file below
# This file contains the WSGI configuration required to serve up your
# web application at http://<your-username>.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#
# The below has been auto-generated for your Flask project
import sys
# add your project directory to the sys.path
project_home = '/home/mp3096/mysite'
if project_home not in sys.path:
sys.path = [project_home] + sys.path
# import flask app but need to call it "application" for WSGI to work
from app import app as application # noqa
//////////////////// THE ISSUE HERE IS IT WONT DETECT CHAT FOLDER AT ALL i dont know is there any way to add it to wsgi file? as those py files inside chat folder are being used by app.py