Задача:
перенаправлять с mysite.com/shop_slug/action на shop_slug.mysite.com/action
Установил django-hosts, прописал hosts.py:
from django_hosts import patterns, host
host_patterns = patterns('',
host(r'(?P<shop_slug>\w+)', 'shop.urls', name='shop_sub'),
host(r'www', 'main.urls', name='home'),
)
shop.urls:
from django.conf.urls import url
from shop import views
urlpatterns = [
url('^(?P<slug>\w+)/$', views.ProductListView.as_view(), name='product_list'),
url('^$', views.CreateShopView.as_view(), name='create_shop'),
url(r'^(?P<slug>\w+)/product/(?P<productId>\d+)/$', views.ProductDetailView.as_view(),
name="product_detail"),
url(r'^(?P<slug>\w+)/category/(?P<category_id>\d+)/$', views.CategoryView.as_view(), name='view_category'),
]
settings.py:
ROOT_URLCONF = 'main.urls'
DEFAULT_HOST = 'home'
ROOT_HOSTCONF = 'hosts'
при попытке зайти на shop_slug.localhost:8000 говорит, что не может найти страницу
Что я делаю не так?