Question

Getting "No Module found" when running runscript as follows:

I am trying to use the python manage.py dumpscript in Django extensions to move data from SQLite to postgres. (Having errors using dumpdata and loaddata on this particular model)

I generated what seems like a good script. my issue is that I cannot run the result. The doc says that it must be a module and to place an init.py in the directory, which I have (it is in the same directory as the blogpostexp.py file) so, once again I'm missing some basic python knowledge here??

1st I use the sqlite Django settings file and run:

tom@tom-Satellite-A105:~/reschool/careers5$ python manage.py dumpscript blog.BlogPost >     blogpostexp.py
Processing model: BlogPost
Re-processing model: BlogPost 

Then I change the Django settings file to the postgres file and run:

(mezz4)tom@tom-Satellite-A105:~/reschool/careers5$ python manage.py runscript blogpostexp
No module for script 'blogpostexp' found
Was it helpful?

Solution

Got it! you need to put the generated script in a folder "scripts" and just run (mezz4)tom@tom-Satellite-A105:~/reschool/careers5$ python manage.py runscript blogpostexp I had a few syntax errors relating to tzinfo= I deleted those and the content was imported! There were other issues about missing categories, but they did not stop the import. I suppose if I had generated off the app instead of the model I could have gotten that also but probably with other issues..

All in all this seems like the most straightforward way to move SQLLITE to postgres in Django if there is any issue with the regular dumpdata loaddata methods.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top