views:

68

answers:

2

Hello,

I'm trying to restore the current working database to the data stored in a .sql file from within Django. Whats the best way to do this? Does django have an good way to do this or do I need to grab the connection string from the settings.py file and send command line mysql commands to do this?

Thanks for your help.

+1  A: 

Django doesn't have any built-in commands for loading SQL fixtures. If you happen to have it in some sort of serialized file, like JSON, you can use the loaddata command of django-admin or manage.py.

You can read about it here.

Pewpewarrows
+1  A: 

You can't import sql dumps through django; import it through mysql directly, if you run mysql locally you can find various graphical mysql clients that can help you with doing so; if you need to do it remotely, find out if your server has any web interfaces for that installed!

lazerscience