Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize MULTISITE_CMS_* settings #12

Open
jedie opened this issue Jul 20, 2016 · 3 comments
Open

optimize MULTISITE_CMS_* settings #12

jedie opened this issue Jul 20, 2016 · 3 comments
Assignees

Comments

@jedie
Copy link
Contributor

jedie commented Jul 20, 2016

The default from README:

MULTISITE_CMS_URLS={
    'www.example.com': 'tests.test_utils.urls1',
    'www.example2.com': 'tests.test_utils.urls2',
},
MULTISITE_CMS_ALIASES={
    'www.example.com': ('alias1.example.com', 'alias2.example.com',),
    'www.example2.com': ('alias1.example2.com', 'alias2.example2.com',),
},
MULTISITE_CMS_FALLBACK='www.example.com'
  1. You have to insert three times www.example.com -> What's about DRY ?
  2. You didn't see the SITE_ID

What's about something like this:

MULTISITE_CMS={
    1: { # SITE_ID == 1
        'DOMAIN': 'www.example.com',
        'URLS': 'example_project.urls1',
        'ALIASES': ('alias1.example.com', 'alias2.example.com',)
    },
    2: {  # SITE_ID == 2
        'DOMAIN': 'www.example2.com',
        'URLS': 'example_project.urls2',
        'ALIASES': ('alias1.example2.com', 'alias2.example2.com',)
    },
}
MULTISITE_CMS_FALLBACK=1 # SITE_ID == 1
@yakky
Copy link
Member

yakky commented Jul 21, 2016

Thanks for the suggestion

@jedie
Copy link
Contributor Author

jedie commented Jul 21, 2016

...we have already multisite.models.Alias to match alias to SITE_ID's:

https://github.com/ecometrica/django-multisite/blob/master/multisite/models.py#L151

So MULTISITE_CMS_ALIASES is redundant, isn't it?

@yakky
Copy link
Member

yakky commented Sep 25, 2018

@jedie it partially is: you can use one instead of the other. Sometimes you just don't need to work in the admin to handle this, and just use some settings
Currently I have no capacity to handle the change to the suggested configuration structure, but I will gladly accept a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants