johntynan / django-newsroom

Automatically exported from code.google.com/p/django-newsroom
Other
0 stars 0 forks source link

Loading Test Data #51

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This may come down to personal preference. But to load test data I created
a fixtures directory at 

/home/john/sites/dev.news21.com/pinax-dev/pinax-working/newsroom_project/fixture
s

I also created the entry

FIXTURE_DIRS = (
'/home/john/sites/dev.news21.com/pinax-dev/pinax-working/newsroom_project/fixtur
es',
) 

in local_settings.py

Then, I ran the command ./manage.py dumpdata >> core.project stories promos
topics
/home/john/sites/dev.news21.com/pinax-dev/pinax-working/newsroom_project/fixture
s/initial_data.json

To load the data back in, I ran the command ./manage.py flush

Would this be a good way to exchange test data?

If so, would it be appropriate to check in this fixtures directory into the
repository and ask people to update the initial_data.json file after making
any changes to the models?

Original issue reported on code.google.com by jgty...@gmail.com on 4 May 2009 at 4:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Actually, I had the command wrong, here it is:

./manage.py dumpdata core.project stories promos topics >>
/home/john/sites/dev.news21.com/pinax-dev/pinax-working/newsroom_project/fixture
s/initial_data.json

Here is a copy of the initial_data.json file (current as of r372 )

Original comment by jgty...@gmail.com on 4 May 2009 at 4:30

Attachments:

GoogleCodeExporter commented 9 years ago
Finding out how tenuous and breakable this idea actually is.  Looking at
http://south.aeracode.org/

Original comment by jgty...@gmail.com on 4 May 2009 at 5:25

GoogleCodeExporter commented 9 years ago
From within pinax-env$ pip install south 

Works great! Installs to pinax-env/lib/python2.5/site-packages/south

I then added 'south' to my settings.py #external

as well as SOUTH_AUTO_FREEZE_APP = True

Then deleted sites.db to start fresh and ran:

./manage.py syncdb

Note:

Creating table south_migrationhistory

Then ran:

./manage.py startmigration stories --initial

Afterward, ran:

./manage.py migrate stories

I received an sqlite3.OperationalError: table "stories_story" already exists

However, I have the feeling this is enough to get us in the ballpark.  And it 
appears
that there are some nuances to this process that would likely benefit our all
becoming familiar with this process.

Milan, please test this and see if this works for you.  

If this indeed works, should we check in the migrations folder under certain 
apps? 
Establish some kind of procedure for handling migrations / changes to the 
models?

THX!

Original comment by jgty...@gmail.com on 4 May 2009 at 6:21

GoogleCodeExporter commented 9 years ago
So  I think we're going to de-prioritize this for now since schema changes 
before the inital release should be 
minimal.

Original comment by mand...@gmail.com on 5 May 2009 at 12:34