user1
user1

Reputation: 2259

Do i need to add URLs for flat pages in url.py in django

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

Upvotes: 0

Views: 695

Answers (3)

Subin Shrestha
Subin Shrestha

Reputation: 1232

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

Upvotes: 0

Alex Jillard
Alex Jillard

Reputation: 2832

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.

Upvotes: 1

Samuele Mattiuzzo
Samuele Mattiuzzo

Reputation: 11048

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

Upvotes: 0

Related Questions