Всем доброго времени суток. В Django проекте есть приложение, у него такой класс
class IndexPageConfig(AppConfig):
name = 'index_page'
index_view = get_class('index_page.views', 'IndexView')
def urls(self):
return [
url(r'^$', self.index_view.as_view(), name='home'),
]
В файле urls.py самого проекта пишу так
index_page_app = get_class('apps.index_page.apps', 'IndexPageConfig')
urlpatterns = [
url(r'', include(index_page_app.urls)),
]
И получаю такую ошибку: django.core.exceptions.ImproperlyConfigured: The included URLconf '<function IndexPageConfig.urls at 0x1042caae8>' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
Причем если в приложении создать поле класса
class IndexPageConfig(AppConfig):
name = 'index_page'
index_view = get_class('index_page.views', 'IndexView')
urls = [
url(r'^$', index_view.as_view(), name='home'),
]
То ошибки нет. Как можно исправить первый случай? Ведь по ООП надо делать примерно как в первом случае у меня