0
votes

I have a django project and a dump.json file in which all the database dump is present.

I am trying to run this command to load data into my django project

django-admin loaddata dumpdata.json --settings=~/Workspace/odx-lm/lm/settings/local.py

On running the above command from the folder ~/Workspace/odx-lm/,
I am getting the following error:

Traceback (most recent call last): File "/home/delhivery/Workspace/odx-lm/odx-lm-env/bin/django-admin.py", line 5, in management.execute_from_command_line() File "/home/delhivery/Workspace/odx-lm/odx-lm-env/local/lib/python2.7/site-packages/django/core/management/init.py", line 367, in execute_from_command_line utility.execute() File "/home/delhivery/Workspace/odx-lm/odx-lm-env/local/lib/python2.7/site-packages/django/core/management/init.py", line 316, in execute settings.INSTALLED_APPS File "/home/delhivery/Workspace/odx-lm/odx-lm-env/local/lib/python2.7/site-packages/django/conf/init.py", line 53, in getattr self._setup(name) File "/home/delhivery/Workspace/odx-lm/odx-lm-env/local/lib/python2.7/site-packages/django/conf/init.py", line 41, in _setup self._wrapped = Settings(settings_module) File "/home/delhivery/Workspace/odx-lm/odx-lm-env/local/lib/python2.7/site-packages/django/conf/init.py", line 97, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name) ImportError: Import by filename is not supported.

Any help would be highly appreciated.

1
The path should be the path to your dumpdata.json file. For example django-admin loaddata workspace/dumpdata.jsonMarcell Erasmus
I tried this thing too: django-admin.py loaddata ~/Workspace/odx-lm/dumpdata.json --settings=~/Workspace/odx-lm/lm/settings/local.pyBhawan

1 Answers

3
votes

The value for settings must be a Python module path, not a file path.

... --settings=lm.settings.local