Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a way to load fixtures into the site #11

Open
shaib opened this issue Mar 18, 2018 · 6 comments
Open

Make a way to load fixtures into the site #11

shaib opened this issue Mar 18, 2018 · 6 comments

Comments

@shaib
Copy link
Member

shaib commented Mar 18, 2018

Basically a view that does loaddata -- which will allow us to prepare data files and load them in without including them in the site sources.

It would be nice if this view can also handle media files.

At some point we want a solution which allows downloading "full data" (including both data and dynamic media) as a backup; if the "upload" solution can just take whatever the "backup" produces, it could be really nice.

@AmitAronovitch
Copy link
Collaborator

the current solution: include in git (under static/src), then use heroku Procfile to make links in ilpycon/site_media.

@MeirKriheli
Copy link
Collaborator

Can't one simply do:

heroku run python manage.py loaddata the_fixture

@shaib
Copy link
Member Author

shaib commented May 18, 2018

Yes, I don't think there's anything left to do here. If anyone disagrees, please reopen.

@shaib shaib closed this as completed May 18, 2018
@AmitAronovitch
Copy link
Collaborator

FTR the method suggested by Meir does not work. Or rather, it only works if you have the fixture on the dyno.

The whole point is that we do not want it in the git repo (e.g. might contain sensitive user data), and it is surpisingly difficult to get data files into the dyno in other ways (most reliable way I found was using netcat with two terminals).

@AmitAronovitch
Copy link
Collaborator

However, there is another way which does work: use local manage.py with heroku's postgresql db:

  • type heroku config to get the connection parameters of the heroku postgresql
  • export DATABASE_URL=...
  • ./manage.py loaddata fixture_name
    very hacky and insecure (must remember to unset the env var when done), but handy...

@shaib
Copy link
Member Author

shaib commented May 19, 2018

Really? The PG instance is accessible from outside? That's worrying...

The way to make sure you don't "forget to unset the env var" is not to export it at all:

DATABASE_URL=... ./manage.py loaddata fixture_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants