Flatpages

38 views
Skip to first unread message

Lee Hinde

unread,
Aug 15, 2014, 1:40:43 PM8/15/14
to django...@googlegroups.com
I added flatpages to a project and got it working fine locally, using dev server, but I get a 404 accessing my test page when I push to production.

Googling the issue,  most common complaints fixed by making sure SITE_ID was set, and that's in place in my site.

I'm not using middleware, I'm using the url:

urlpatterns += patterns('django.contrib.flatpages.views',

    (r'^(?P<url>.*/)$', 'flatpage'),

)

I'm not sure how to debug this...

Collin Anderson

unread,
Aug 15, 2014, 1:55:37 PM8/15/14
to django...@googlegroups.com
What is your page's url? Does it end with a slash?

Lee Hinde

unread,
Aug 15, 2014, 2:15:25 PM8/15/14
to django...@googlegroups.com
It's /test/. The flatpages admin form won't accept a url that doesn't begin and end in a slash.


On Fri, Aug 15, 2014 at 10:55 AM, Collin Anderson <cmawe...@gmail.com> wrote:
What is your page's url? Does it end with a slash?

-- 

C. Kirby

unread,
Aug 15, 2014, 2:30:48 PM8/15/14
to django...@googlegroups.com
Is it only occurring on the flatpages test page or all your pages (or is that the only page)? Remember you need ALLOWED_HOSTS set in production[1]

[1]https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts

Lee Hinde

unread,
Aug 15, 2014, 2:38:55 PM8/15/14
to django...@googlegroups.com
It's the only page; I'll double-check allowed hosts...

Thanks.

Lee Hinde

unread,
Aug 15, 2014, 2:41:52 PM8/15/14
to django...@googlegroups.com
Yes, ALLOWED_HOSTS is set. This site has been in production since late March, so it's otherwise a going concern. (1.6.x, which I didn't mention earlier).

Collin Anderson

unread,
Aug 15, 2014, 2:43:15 PM8/15/14
to django...@googlegroups.com
I also assume you added the page to the production database and not just your dev database (if they're different)?

Lee Hinde

unread,
Aug 15, 2014, 2:58:49 PM8/15/14
to django...@googlegroups.com
Yes, it's a record in the flatpages table on the production side.


On Fri, Aug 15, 2014 at 11:43 AM, Collin Anderson <cmawe...@gmail.com> wrote:
I also assume you added the page to the production database and not just your dev database (if they're different)?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b3aecbf7-9dca-44b7-88e9-49ef80f2fb94%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

C. Kirby

unread,
Aug 15, 2014, 3:19:20 PM8/15/14
to django...@googlegroups.com
There is a warning about APPEND_SLASH = False in the flatpages documentation:

Warning

If you set APPEND_SLASH to False, you must remove the slash in the catchall pattern or flatpages without a trailing slash will not be matched.

Could it be that?

Lee Hinde

unread,
Aug 15, 2014, 4:57:01 PM8/15/14
to django...@googlegroups.com
I don't have APPEND_SLASH in my settings and the default is True, so I don't think that's it. 

Also, I used the django extension show_urls and the flatpages url showed up in the output, so I think it's in the chain.

Collin Anderson

unread,
Aug 15, 2014, 5:10:46 PM8/15/14
to django...@googlegroups.com
SITE_ID is set, but is the correct site selected on the flatpage?

Lee Hinde

unread,
Aug 15, 2014, 5:22:21 PM8/15/14
to django...@googlegroups.com
Yes.

Lee Hinde

unread,
Aug 15, 2014, 5:24:05 PM8/15/14
to django...@googlegroups.com
I just logged into the backend to make sure the django_flatpage_sites table was populated and it is.
Reply all
Reply to author
Forward
0 new messages