Forums

i am not able to connect my database which i have created in pythonanywhere

[formatted by admin]

with open('confiq.json', 'r') as c:
    values = json.load(c)["params"]

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://username:password@mysql.server/databasename'
db = SQLAlchemy(app)
app.secret_key = values['secretkey']

what will be the database name? mysql.server is this right, or i have to assign something different in this field, and one more question i have json file in the same directory in which my main file is can i open JSON as i have done IN THE begining.

In your example mysql.server would be the host, something like Aaqibwani.mysql.pythonanywhere-services.com and database name would look like Aaqibwani$something. If you're using SQLAlchemy you might need that extra step: https://help.pythonanywhere.com/pages/UsingSQLAlchemywithMySQL. I don't see your whole code -- what kind of errors do you get?