Question

I have two sites using Django-CMS. They use the same code and the same database, with the SITE_ID distinguishing them.

On the site with SITE_ID = 1, all is fine.

On the site with SITE_ID = 2, some pages that I publish (using the admin panel) can only be seen on the site if you are logged in. Otherwise they give me a 404 Error with a message like

CMS: Page not found for "test"

Other pages are ok - specifically the home page, and pages with apphooks.

If I set DEBUG = False, I get 404 errors on all my site's pages!

This is happening both in prod and on my dev server. In fact it happens even on a completely vanilla test site that I have just created too.

I did not chose "login required" for any of the pages.

How can I make the pages visible to all?

Version info: I am using Django-CMS 2.4.1 and Django 1.5.1. I also upgraded them to mptt 0.5.5, although Django-CMS specifically only installs mptt 0.5.2 (see this post for why). However, when I re-installed mptt 0.5.2 on my dev server the problem remained.

Was it helpful?

Solution

I raised this as an issue and now have the answer - it is the 'public': False line in this code:

CMS_LANGUAGES = {
    1: [
        {
            'code': 'en',
            'name': gettext('English'),
            'public': True,
        },
    ],
    'default': {
        'fallbacks': ['en',],
        'public': False,
        }
}

The key "1" is the SITE_ID, so the above says to hide all sites after number 1 from the public.

So the solution is to add an entry keyed off SITE_ID 2 in the CMS_LANGUAGES setting.

OTHER TIPS

I think you need to first have a look at the ALLOWED_HOSTS setting (https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts). This is very likely the reason you get errors when you turn off DEBUG. (although, I thought not having a legit ALLOWED_HOSTS would produce 500 errors, not 404s.).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top