annotate gpp/urls.py @ 552:9e42e6618168

For bitbucket issue #2, tweak the admin settings for the Post model to reduce slow queries. Define our own queryset() method so we can control the select_related(), and not have it cascade from post to topics to forums to categories. Removed 'topic' from list_display because MySQL still sucked with 2 inner joins. Now it seems to be tolerable with only one join to User.
author Brian Neal <bgneal@gmail.com>
date Wed, 25 Jan 2012 20:07:03 -0600
parents c092efc9ce71
children bcc4e8cf841b
rev   line source
gremmie@1 1 from django.conf.urls.defaults import *
bgneal@6 2 from django.conf import settings
gremmie@1 3 from django.contrib import admin
bgneal@177 4 from django.views.decorators.cache import cache_page
bgneal@170 5
bgneal@415 6 from haystack.views import search_view_factory
bgneal@219 7
gremmie@1 8 from news.feeds import LatestNewsFeed
bgneal@170 9 from forums.feeds import ForumsFeed
bgneal@469 10 from custom_search.forms import CustomModelSearchForm
gremmie@1 11
bgneal@141 12
gremmie@1 13 admin.autodiscover()
gremmie@1 14
gremmie@1 15 urlpatterns = patterns('',
bgneal@19 16 url(r'^$', 'views.home', name='home'),
gremmie@1 17 (r'^admin/doc/', include('django.contrib.admindocs.urls')),
gremmie@1 18 (r'^admin/', include(admin.site.urls)),
gremmie@1 19 (r'^accounts/', include('accounts.urls')),
bgneal@215 20 (r'^antispam/', include('antispam.urls')),
gremmie@1 21 (r'^calendar/', include('gcalendar.urls')),
gremmie@1 22 (r'^comments/', include('comments.urls')),
gremmie@1 23 (r'^contact/', include('contact.urls')),
bgneal@540 24 (r'^contests/', include('contests.urls')),
bgneal@127 25 (r'^core/', include('core.urls')),
bgneal@35 26 (r'^donations/', include('donations.urls')),
gremmie@1 27 (r'^downloads/', include('downloads.urls')),
bgneal@176 28 url(r'^feeds/news/$',
bgneal@177 29 cache_page(LatestNewsFeed(), 6 * 60 * 60),
bgneal@176 30 name='feeds-news'),
bgneal@176 31 url(r'^feeds/forums/$',
bgneal@509 32 cache_page(ForumsFeed(), 5 * 60),
bgneal@176 33 {'forum_slug': None},
bgneal@176 34 'feeds-forum_combined'),
bgneal@176 35 url(r'^feeds/forums/(?P<forum_slug>[\w\d-]+)/$',
bgneal@509 36 cache_page(ForumsFeed(), 5 * 60),
bgneal@176 37 name='feeds-forum'),
bgneal@81 38 (r'^forums/', include('forums.urls')),
gremmie@1 39 (r'^irc/', include('irc.urls')),
gremmie@1 40 (r'^links/', include('weblinks.urls')),
gremmie@1 41 (r'^member_map/', include('membermap.urls')),
gremmie@1 42 (r'^messages/', include('messages.urls')),
gremmie@1 43 (r'^news/', include('news.urls')),
bgneal@285 44 (r'^oembed/', include('oembed.urls')),
bgneal@544 45 (r'^pb/', include('phantombrigade.urls')),
gremmie@1 46 (r'^podcast/', include('podcast.urls')),
gremmie@1 47 (r'^polls/', include('polls.urls')),
gremmie@1 48 (r'^potd/', include('potd.urls')),
gremmie@1 49 (r'^profile/', include('bio.urls')),
gremmie@1 50 (r'^shout/', include('shoutbox.urls')),
bgneal@12 51 (r'^smiley/', include('smiley.urls')),
bgneal@323 52 (r'^ygroup/', include('ygroup.urls')),
gremmie@1 53 )
gremmie@1 54
bgneal@219 55 # Haystack search views
bgneal@219 56 urlpatterns += patterns('haystack.views',
bgneal@415 57 url(r'^search/$',
bgneal@438 58 search_view_factory(form_class=CustomModelSearchForm, load_all=True),
bgneal@219 59 name='haystack_search'),
bgneal@219 60 )
bgneal@219 61
bgneal@219 62
gremmie@1 63 if settings.DEBUG:
bgneal@325 64 urlpatterns += patterns('',
bgneal@325 65 (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
gremmie@1 66 )