Reputation: 173
I try to deploy my website developped with Django 1.9. I use the web hosting AlwaysData.
The problem is that the database of my web hosting is empty (no tables) and I want to import my tables (in models.py) in this database.
For that, I need a file sql that contains all my tables. After I will import this file in my AlwaysData database.
I try the command dumpdata but the format sql doesn't exist (only yaml, xml and json).
How can I do ?
I use PostGreSQL.
Thank you
Upvotes: 0
Views: 3233
Reputation: 17003
I would think that you could build your database using ./manage.py makemigrations
and then ./manage.py migrate
. However, if that does not work for you, it sounds like you want the sqlmigrate
management command:
./manage.py sqlmigrate my_app my_migration > my_migration.sql
This will generate the SQL for your migration, and redirect it to a file called my_migration.sql
.
Upvotes: 5