Forums

cron job to modify a App database.

Hi all,

I am quite a beginner when it comes to programming, so bare with me.

I need to create a cron job that needs to insert a record into a database table belonging to a web application.

for reference- for your expert help.... the table i need to insert is stored here: "/home/tenissocial/lovetennisapp/applications/VIRTUAL_MATCHES/databases/vplayers.table"

I've manage to create a scheduled task with is running. this is located at: /home/tenissocial/lovetennisapp/applications/VIRTUAL_MATCHES/cron/testing.py

but I cant find how to setup the DB connection to the application database?

host = 'tenissocial.mysql.pythonanywhere-services.com'
db = MySQLdb.connect(host=host,user='tenissocial',passwd='XXXXXX',db='???????????')

was the closest I got, but hwhat db do I need to connect? can someone point me to thr right direction.

Many thanks in advance. Kind regards, Pedro

Take the db name from the "Databases" page on PythonAnywhere. It's something like "tenissocial$default"