Код должен парсить и добавлять книги в дб
from requests import get
from bs4 import BeautifulSoup
from books.models import Book
for book_id in range(101724, 130000):
try:
html = get('http://read.ru/book/{0}/'.format(book_id))
b = BeautifulSoup(html.text, "html.parser")
book_article = b.select('.book-article--title')[0].getText()
book_description = b.select('.book-article--description p')[0].getText()
text = "Book title: {0} Description: {1}".format(book_article, book_description)
Book.objects.create(title=book_article, slug=slugify(book_article), description=book_description)
print(text)
except:
print("Error")
Выходит ошибка: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Как исправить?