The Issue I Am Getting Is That, I Have A Form Which Takes Input User Data and sends the data through The Server to the database, Both the backend and Frontend starts and the data is also stored to the database when form is filled and on which(device) the server is running, but when we try to access the project from different device for form entry then the data is not added to the database
#Import required libraries
import pymongo
from flask import Flask, request, jsonify,render_template
from bson.objectid import ObjectId
from flask_cors import CORS,cross_origin
import export
export.init(default=export.PUBLIC)
#Connect to MongoDB Atlas
client = pymongo.MongoClient("mongodb+srv://D:D@cluster0.unaufu9.mongodb.net/R?retryWrites=true&w=majority")
db = client.R
#Initialize flask application
app = Flask(__name__)
CORS = (app)
@app.route("/")
def my_index():
return render_template("<h1>HEll O! World",flask_token="hello")
It is running on a particular device but not on the other device like all the projects should do.
I would recommend if you want to add data using another device you can can the ip of the system that has backend up and running then change the http://127.0.0.1:5000 to that IP (example: http://192.168.11.22:5000 ).
Keep in mind both devices should be connect from same internet connection
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.