No problem! I do this all the time.
As far as the "don't edit or update the data", just don't add anything to your app that would update the data. Salem's suggestion about using permissions on the MySQL side is a good idea as well.
For retrieving the data, you have two options:
1) You can create Django models that correspond to your tables in the MySQL database. You can do this manually, or you can use the "inspectdb" command with manage.py to give yourself a good starting point. Then do something like this:
def myview(request):
rows = MyModel.objects.using('mysql').all()
return render_to_response("mytemplate.html", {"rows" : rows })
2) You can manage the connections and queries manually within your app. This is perfectly valid within a view:
def myview(request):
conn = MySQLdb.connect("connection info here")
try:
cursor = conn.cursor()
cursor.execute("select * from mytable")
rows = cursor.fetchall()
finally:
conn.close()
return render_to_response("mytemplate.html", {"rows" : rows})
finally -- Django is perfectly happy to use MySQL as a database. It might simplify things if your DBA will let Django create its tables right in the same database.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…