Anonymous user
Importing a data snapshot: Difference between revisions
m
→In case of memory problems
imported>E2jk (→How to use a snapshot: The snapshot does not need to be ungzipped) |
imported>Onceuponatimeforever |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1:
{{Hacking OpenHatch}}
When you get your own instance of the OpenHatch code running, you'll discover you're missing the ''data'' that are on the main OpenHatch site.
== Where you can find the snapshots ==
You may download a snapshot of the OpenHatch data from:
* http://inside.openhatch.org/snapshots/
'''Note''': We go through some effort to remove private information before we publish user data in these snapshots. The code for that is [https://github.com/openhatch/oh-mainline/blob/master/mysite/customs/management/commands/snapshot_public_data.py here].
== Privacy implications ==
Line 12 ⟶ 15:
== How to use a snapshot ==
'''Note''': You must run
<tt>python manage.py syncdb --noinput</tt>
'''Note''': You must run <tt>python manage.py syncdb --noinput</tt> and <tt>python manage.py migrate</tt> before this will work. Read <tt>README.mkd</tt> to learn more about those commands. It should take less than one minute.▼
and
Once the snapshot file has been retrieved on your computer, load it (no need to uncompress the file):▼
<tt>python manage.py migrate</tt>
▲
1. Copy the downloaded snapshot file into the 'oh-mainline' directory. The snapshot file is named as ''date.json.gz'' where 'date' is in the form YYYY-MM-DD.
▲
python manage.py loaddata ''2012-08-12.json.gz''
'''Note:''' This may take a long time (10-15 minutes) without any output. This is normal.
You'll see output that looks something like this:
Line 24 ⟶ 38:
Installed 94858 object(s) from 1 fixture(s)
3. Then, run the following command to update the database file ''mysite.db'' with the new data snapshot:
python manage.py syncdb
You can test that it worked by loading up your local projects page and ensuring it is not empty. Access http://127.0.0.1:8000/projects/ (and compare it to http://openhatch.org/projects/ if you like!) to check.
== In case of memory problems ==
In case your operating system has problems with loading the giant set of all the production data, you can get the db file directly from http://inside.openhatch.org/snapshots/. The important critical step is to remember to change the name of the existing development db file to a different name (in case you need it later) and then you change the newly downloaded db file name to ''site.db''.
python manage.py syncdb --noinput --migrate
python manage.py migrate
python manage.py loaddata NAME_OF_SNAPSHOT.gz
== More about this ==
* We go through some effort to remove private information before we publish user data in these snapshots. The code for that is
* We are now creating these snapshots once a day.
|