From aca7f25034a7db679c5f8e02c9d12833d70cc152 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 14 Oct 2013 17:06:05 +0200 Subject: [PATCH 1/1] Starting with mil app --- edumed/settings.d/20-basic.py | 5 +++++ edumed/settings.d/40-middleware.py | 1 + mil/__init__.py | 0 mil/urls.py | 7 +++++++ mil/views.py | 5 +++++ requirements.txt | 1 + 6 files changed, 19 insertions(+) create mode 100644 mil/__init__.py create mode 100644 mil/urls.py create mode 100644 mil/views.py diff --git a/edumed/settings.d/20-basic.py b/edumed/settings.d/20-basic.py index 3c900c8..340a94c 100644 --- a/edumed/settings.d/20-basic.py +++ b/edumed/settings.d/20-basic.py @@ -23,6 +23,11 @@ TEMPLATE_LOADERS = ( ROOT_URLCONF = 'edumed.urls' +SUBDOMAIN_URLCONFS = { + None: 'edumed.urls', + 'katalog': 'mil.urls', +} + # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'edumed.wsgi.application' diff --git a/edumed/settings.d/40-middleware.py b/edumed/settings.d/40-middleware.py index b9c614d..998b707 100644 --- a/edumed/settings.d/40-middleware.py +++ b/edumed/settings.d/40-middleware.py @@ -3,6 +3,7 @@ MIDDLEWARE_CLASSES = tuple(x for x in ( 'django.contrib.sessions.middleware.SessionMiddleware' if "django.contrib.sessions" in INSTALLED_APPS else None, #'django.middleware.locale.LocaleMiddleware', + 'subdomains.middleware.SubdomainURLRoutingMiddleware', 'fnpdjango.middleware.URLLocaleMiddleware', 'django.middleware.common.CommonMiddleware', diff --git a/mil/__init__.py b/mil/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mil/urls.py b/mil/urls.py new file mode 100644 index 0000000..4f765de --- /dev/null +++ b/mil/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import patterns, include, url +from .views import root + + +urlpatterns = patterns('', + url(r'^$', root, name="root"), +) diff --git a/mil/views.py b/mil/views.py new file mode 100644 index 0000000..5d7fcbf --- /dev/null +++ b/mil/views.py @@ -0,0 +1,5 @@ +from django.http import HttpResponse + + +def root(request): + return HttpResponse('mil') \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 49b1e28..1a8d1d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,3 +35,4 @@ django-libravatar sorl-thumbnail>=11,<12 pyyaml +django-subdomains>=2.0.4,<2.1 -- 2.20.1