Importing models in other files

26 views
Skip to first unread message

Ronak Mistry

unread,
Jan 3, 2021, 1:57:08 AM1/3/21
to django...@googlegroups.com
Hello there.
I had created a web scraper to scrape some data and want to store it in database.
The scraper returns a separate list of all the fields required in my model.
Does anyone know how to do it.

I had tried to write : 
import django
django.setup()

In the beginning of the file but still it doesn't work 

the error says,

Traceback (most recent call last):
  File "D:\Workspace\IMDB scraping\scraper\webscrape.py", line 4, in <module>
    django.setup()
  File "D:\Workspace\IMDB scraping\venv\lib\site-packages\django\__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "D:\Workspace\IMDB scraping\venv\lib\site-packages\django\conf\__init__.py", line 83, in __getattr__
    self._setup(name)
  File "D:\Workspace\IMDB scraping\venv\lib\site-packages\django\conf\__init__.py", line 70, in _setup
    self._wrapped = Settings(settings_module)
  File "D:\Workspace\IMDB scraping\venv\lib\site-packages\django\conf\__init__.py", line 177, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "C:\Python3.9\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'imdbapi'


so please help me asap...
Thanks in advance
Reply all
Reply to author
Forward
0 new messages