Compare commits

...

10 commits

Author SHA1 Message Date
Iacopo Spalletti
ab3df90923 Merge pull request #18 from nephila/feature/reload_urlconf
Force reload at each request
2017-01-06 16:46:03 +01:00
Iacopo Spalletti
7d2013f62b Fix typo 2017-01-06 16:45:52 +01:00
Iacopo Spalletti
1999784b2f
Force reload at each request 2017-01-01 18:21:17 +01:00
Iacopo Spalletti
9d07f0c714 Merge pull request #11 from stefanfoulis/feature/graceful-default-settings
graceful handling of unset settings
2017-01-01 18:19:59 +01:00
Iacopo Spalletti
d177a83fa5 Merge pull request #17 from nephila/feature/improve_setup
Improve setup
2017-01-01 18:15:44 +01:00
Iacopo Spalletti
619a088d2c
Add django 1.10 / cms 3.4 2017-01-01 17:19:31 +01:00
Iacopo Spalletti
7be32d8c08
Add -optional- djangocms-blog to test environment 2017-01-01 17:19:06 +01:00
Iacopo Spalletti
e970887206 Merge pull request #14 from jedie/patch-1
typo: SiteID() and not SiteId()
2016-07-21 09:57:51 +02:00
Jens Diemer
7355c710a6 typo 2016-07-20 17:54:42 +02:00
Stefan Foulis
77ac20544a always patch_vary_headers on Host 2016-07-12 11:20:32 +02:00
7 changed files with 55 additions and 15 deletions

View file

@ -14,8 +14,11 @@ env:
- TOXENV='pep8'
- TOXENV='isort'
- TOXENV='docs'
- DJANGO='django110' CMS='cms34'
- DJANGO='django19' CMS='cms34'
- DJANGO='django19' CMS='cms33'
- DJANGO='django19' CMS='cms32'
- DJANGO='django18' CMS='cms34'
- DJANGO='django18' CMS='cms33'
- DJANGO='django18' CMS='cms32'

View file

@ -48,7 +48,7 @@ Usage
#. Configure django-multisite as documented upstream
#. Use ``SITE_ID = SiteId(default=1)`` instead of the documented ``SITE_ID = SiteID()``
#. Use ``SITE_ID = SiteID(default=1)`` instead of the documented ``SITE_ID = SiteID()``
#. Add ``multisite``, ``djangocms_multisite`` to ``INSTALLED_APPS``::

View file

@ -14,7 +14,7 @@ HELPER_SETTINGS = dict(
ROOT_URLCONF='tests.test_utils.urls1',
INSTALLED_APPS=[
'multisite',
'djangocms_text_ckeditor'
'djangocms_text_ckeditor',
],
LANGUAGE_CODE='en',
LANGUAGES=(
@ -56,9 +56,34 @@ HELPER_SETTINGS = dict(
'www.example.com': ('alias1.example.com', 'alias2.example.com',),
'www.example2.com': ('alias1.example2.com', 'alias2.example2.com',),
},
MULTISITE_CMS_FALLBACK='www.example.com'
MULTISITE_CMS_FALLBACK='www.example.com',
ALLOWED_HOSTS=['*'],
)
try:
import djangocms_blog
HELPER_SETTINGS['INSTALLED_APPS'].extend([
'filer',
'easy_thumbnails',
'aldryn_apphooks_config',
'cmsplugin_filer_image',
'parler',
'taggit',
'taggit_autosuggest',
'meta',
'djangocms_blog',
])
HELPER_SETTINGS['THUMBNAIL_PROCESSORS'] = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)
HELPER_SETTINGS['META_SITE_PROTOCOL'] = 'http'
HELPER_SETTINGS['META_USE_SITES'] = True
except ImportError:
pass
def run():
from djangocms_helper import runner

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from cms.utils.apphook_reload import reload_urlconf
from django.conf import settings
from django.core.urlresolvers import set_urlconf
from django.utils.cache import patch_vary_headers
@ -36,13 +37,17 @@ class CMSMultiSiteMiddleware(object):
# about the request (e.g MyModel.get_absolute_url()) get the correct
# urlconf.
set_urlconf(urlconf)
try:
# In django CMS 3.4.2 this allows us to save a few queries thanks to per-site appresolvers caching
reload_urlconf(clear_cache=False)
except TypeError:
reload_urlconf()
except KeyError:
# use default urlconf (settings.ROOT_URLCONF)
set_urlconf(None)
def process_response(self, request, response):
if getattr(request, 'urlconf', None):
patch_vary_headers(response, ('Host',))
patch_vary_headers(response, ('Host',))
# set back to default urlconf
set_urlconf(None)
return response

View file

@ -20,6 +20,12 @@ urlpatterns = [
url(r'^jsi18n/(?P<packages>\S+?)/$', javascript_catalog),
]
try:
import taggit_autosuggest
urlpatterns.append(url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')))
except ImportError:
pass
urlpatterns += staticfiles_urlpatterns()
urlpatterns += i18n_patterns(

View file

@ -20,6 +20,12 @@ urlpatterns = [
url(r'^jsi18n/(?P<packages>\S+?)/$', javascript_catalog),
]
try:
import taggit_autosuggest
urlpatterns.append(url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')))
except ImportError:
pass
urlpatterns += staticfiles_urlpatterns()
urlpatterns += i18n_patterns(

15
tox.ini
View file

@ -1,26 +1,21 @@
[tox]
envlist = pep8,isort,docs,py{35,34,27}-django{19}-{cms33,cms32},py{35,34,33,27}-django{18}-cms{33,32,31},py{34,33,27}-django{17,16}-cms{32,31,30},py{26}-django16-cms{31,30}
envlist = pep8,isort,docs,py{35,34,27}-django{110}-cms{34},py{35,34,27}-django{19}-cms{34,33,32},py{35,34,33,27}-django{18}-cms{34,33,32}
[testenv]
commands = {env:COMMAND:python} cms_helper.py test djangocms_multisite
deps =
django16: Django>=1.6,<1.7
django16: django-taggit<0.18
django16: django-mptt<0.8
django17: Django>=1.7,<1.8
django17: django-mptt<0.8
django18: Django>=1.8,<1.9
django18: django-mptt>=0.8
django19: Django>=1.9,<1.10
django19: django-mptt>=0.8
cms30: https://github.com/divio/django-cms/archive/release/3.0.x.zip
cms30: djangocms-text-ckeditor<2.8
cms31: https://github.com/divio/django-cms/archive/release/3.1.x.zip
cms31: djangocms-text-ckeditor<2.9
django110: Django>=1.10,<1.11
django110: django-mptt>=0.8
cms32: https://github.com/divio/django-cms/archive/release/3.2.x.zip
cms32: djangocms-text-ckeditor<3.0
cms33: https://github.com/divio/django-cms/archive/release/3.3.x.zip
cms33: djangocms-text-ckeditor>=3.0
cms34: https://github.com/divio/django-cms/archive/release/3.4.x.zip
cms34: djangocms-text-ckeditor>=3.0
https://github.com/nephila/djangocms-helper/archive/develop.zip
-r{toxinidir}/requirements-test.txt