0

I have enabled flat pages in django

and created page with url /pages/about

so i want to know that do i need to create some url in url.py or not

Because when i try http://ip:8000/pages/about it say page not found

Also when i created page it asked me to select site but iam only using ipaddress, can that be the reason

user1
  • 2,159
  • 3
  • 19
  • 19

3 Answers3

1

No, you don't need to add any urls. The Flatpages middleware kicks in when all of your defined urls fail. There's more info in the docs describing how it works.

Alex Jillard
  • 2,792
  • 2
  • 19
  • 20
  • I have done all the steps but i get error pages not found `http://xx.xx.xx.xx:8000/pages/about/` . what should i do – user1 Jul 05 '11 at 13:50
  • I'd double check the installation steps and make sure you've done them correctly. – Alex Jillard Jul 05 '11 at 14:06
  • The only thing which i think is i don't have any domain name configured. is that the case or it will work on ip address as well – user1 Jul 05 '11 at 14:23
  • As long as you've made the site (in the Django admin), and set the SITE_ID in your settings, using the ip should be fine. – Alex Jillard Jul 05 '11 at 14:30
0

Include this single line code in your root urls.py file

url(r'^pages/', include('django.contrib.flatpages.urls')),

and create flat page file with simple url /about/

Done!!

It works for me

Subin Shrestha
  • 1,212
  • 11
  • 11
0

https://docs.djangoproject.com/en/dev/ref/contrib/flatpages/

and especially this part of the guide shows how you have to configure your urls to use your flatpages

Samuele Mattiuzzo
  • 10,760
  • 5
  • 39
  • 63