Django ImproperlyConfigured at

1

I am starting to use multitenant but I have not been able to move forward because I get this error:

I have not changed anything in the URLs, I share my distribution of files:

The main file urls.py of the project (pruebatenant) is:

from django.conf.urls import patterns, include, url
from django.views.generic.base import TemplateView
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static

admin.autodiscover()

urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # solo en servidor de desarrollo

urlpatterns = patterns('',
    url(r'^select2/', include('django_select2.urls')),

    url(r'^login/$', 'django.contrib.auth.views.login', {'template_name':'login.html'}, name='login'),
    url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page':'login'}, name='logout'),
    url(r'^cambiar-pass/$', 'django.contrib.auth.views.password_change', {'template_name':'cambiar-pass.html', 'post_change_redirect':'login'}, name='cambiar_pass'),

    url(r'^admin/', include(admin.site.urls)),

    url(r'^$', TemplateView.as_view(template_name='publico/index.html'), name='home'),

    url(r'^publico/', include('publico.urls')),
    url(r'^personas/', include('personas.urls')),

) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

The urls.py of people is:      from django.conf.urls import patterns, include, url

urlpatterns = patterns('personas.views.persona',
    url(r'^nueva_persona$', 'nueva_persona', name="nueva_persona"),
)

and the public urls.py is:      from django.conf.urls import patterns, include, url

urlpatterns = patterns('publico.views.principal',
    url(r'^inicio$', 'inicio', name="inicio"),
)

urlpatterns += patterns('publico.views.empresas',
    url(r'^nueva_empresa$', 'nueva_empresa', name="nueva_empresa"),
)
    
asked by Diana Carolina Hernandez 13.01.2016 в 18:03
source

1 answer

3

Diana, the problem is not your URLs, the problem is in your settings.py , if you are using the sites framework (as shown in the image error), you have to define the SITE_ID in your configuration:

# settings.py
...
SITE_ID = 1
...

This should be enough for your application to work. If you do not intend to use it, be sure to remove it or comment on your INSTALLED_APPS :

# settings.py
...
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # 'django.contrib.sites'
    ...
)
...
    
answered by 13.01.2016 / 18:07
source