Доброго времени суток! Я решил немного почистить и струткурировать код. Было принято решение создать парку apps, где бы я хранил все мои приложения, чтоб не было смешивания с шаблонами и статикой и т.д Но после видоизменений получаю ошибку:
ImportError at /
No module named 'cart'
Request Method: GET
Request URL: http://89.223.28.112/
Django Version: 1.10.5
Exception Type: ImportError
Exception Value:
No module named 'cart'
Exception Location: /home/dikiigr/posuda_shop/env/lib/python3.5/importlib/__init__.py in import_module, line 126
Python Executable: /home/dikiigr/posuda_shop/env/bin/python3
Python Version: 3.5.2
Python Path:
['/home/dikiigr/posuda_shop/engine',
'/home/dikiigr/posuda_shop/env/bin',
'/home/dikiigr/posuda_shop/env/lib/python35.zip',
'/home/dikiigr/posuda_shop/env/lib/python3.5',
'/home/dikiigr/posuda_shop/env/lib/python3.5/plat-x86_64-linux-gnu',
'/home/dikiigr/posuda_shop/env/lib/python3.5/lib-dynload',
'/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages']
Но не могу разобраться в чем причина такого действия:
urls.py настроил вроде верно:
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^attributes/', include('apps.attributes.urls', namespace='attributes')),
url(r'^cart/', include('apps.cart.urls', namespace='cart')),
url(r'^menu/', include('apps.menu.urls', namespace='menu')),
url(r'^orders/', include('apps.orders.urls', namespace='orders')),
url(r'^account/', include('apps.accounts.urls', namespace='accounts')),
url(r'^pages/', include('apps.pages.url', namespace='pages')),
url(r'^redactor/', include('redactor.urls')),
url(r'^', include('apps.products.urls', namespace='products')),
]
Установленные приложения тоже вроде все правильно:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'redactor',
'apps.menu',
'apps.products',
'apps.cart',
'apps.orders',
'apps.accounts',
'apps.attributes',
'apps.pages'
]
Новая структура следующая:
То есть файл __init__.py прописан в корне папки apps.
У кого какие догадки по этому поводу?
Traceback:
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
39. response = get_response(request)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/dikiigr/posuda_shop/engine/apps/products/views.py" in main
20. 'section': 'sections/main/main.html'
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/shortcuts.py" in render
30. content = loader.render_to_string(template_name, context, request, using=using)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/template/loader.py" in render_to_string
68. return template.render(context, request)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/template/backends/django.py" in render
66. return self.template.render(context)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/template/base.py" in render
206. with context.bind_template(self):
File "/usr/lib/python3.5/contextlib.py" in __enter__
59. return next(self.gen)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/template/context.py" in bind_template
232. processors = (template.engine.template_context_processors +
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/utils/functional.py" in __get__
35. res = instance.__dict__[self.name] = self.func(instance)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/template/engine.py" in template_context_processors
91. return tuple(import_string(path) for path in context_processors)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/template/engine.py" in <genexpr>
91. return tuple(import_string(path) for path in context_processors)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/site-packages/django/utils/module_loading.py" in import_string
20. module = import_module(module_path)
File "/home/dikiigr/posuda_shop/env/lib/python3.5/importlib/__init__.py" in import_module
126. return _bootstrap._gcd_import(name[level:], package, level)
Exception Type: ImportError at /
Exception Value: No module named 'cart'