Saturday, January 2, 2021

Importing models in other files

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BAL0AtopJyM3ORdCZ-vL%2Bz2fusHTgKOtFubv2c4vVTitUDBzg%40mail.gmail.com.

No comments:

Post a Comment