How do I make my Django app in Dokku use Postgres dump as database?

  • Posted May 6, 2014

Hi, I’ve recently uploaded my Django app to a Dokku droplet, and I want to know how I can make it to work with a dump of a database I have.

I’ve tried restoring to Postgres my dump but it’s not working, but, even if I where to restore data from dump, I still don’t know how can I make my app to use that database.

Could you tell me (baby steps) how can I make my Django app work with a Postgres database in Dokku droplet?

Thanks a lot!


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@Andrew SB <br> <br>It’s been a while, but I wanted to thank you for all your help and effort answering my question. <br> <br>Thanks

This answer over on StackExchange seems relevant: <br> <br> <br> <br>

The dump was created from Heroku where original app exists (I want to migrate)

When I run the command I get <br> <br> PostgreSQL custom database dump - v1.12-0

That seems like you are getting the import commands correct, but you are now hitting another error with charterer encoding. What’s the encoding of your database dump? Run: <br> <br><pre> <br>file youfile.sql <br></pre> <br> <br>

EDIT: When I try to restore

I have a myApp.dump, How could I make it so it becomes a .sql?? <br> <br>When I try I get: <br> <br>invalid command ?4???b@???:??I0j_8?s?A?x??r7??ء4?p?m???c???.?(^???4?~?hslSA?QA?[4?[ir??O <br> ???W?Sq7?uFО? <br>invalid command ?/??(?1?Y=??S?+?٠???3?.M?!??Ku??H_?H߻T??>9 <br>invalid command <綑j??m?H7?} <br>invalid command |?A??c?e? <br> :4V?? <br>invalid command ???uj?f??K?-o??VqY??z;M???~?7g,?G??? <br>ERROR: invalid byte sequence for encoding “UTF8”: 0xea8e51 <br> <br>-----> myApp database restored <br>root@*****:~/myApp/myApp#

@Sascuash: <br> <br>You’d need to install the plugin yourself. Check out that GitHub link for more information, but basically what you need to do is: <br> <br><pre> <br>cd /var/lib/dokku/plugins/ <br>git clone postgresql <br>dokku plugins-install <br></pre> <br> <br>Then to set it up for the first time, you can run: <br> <br><pre> <br>dokku postgresql:create appname <br>dokku postgresql:restore appname < dump_file.sql <br></pre> <br> <br>If you’d rather just access the docker container the app is running directly, you can get a interactive shell with: <br> <br><pre> <br>docker run -i -t dokku/appname /bin/bash <br></pre>

Yes, I’m using the PostgreSQL plugin for Dokku. Now I’m following tutorial

When I do it I find it answers with: <br> <br> Unknown (or too old) PostgreSQL container <br> <br>I’m not sure if I’m using the PostgreSQL plugin for Dokku, when I started the droplet, I selected the Dokku option (instead of Linux distribution, I selected it from application option), so I’m not sure where it comes from. <br> <br>