from django.conf.urls.defaults import patterns, url, include
from django.conf import settings
from django.contrib import admin


admin.autodiscover()


urlpatterns = patterns(
    '',
    # Webserver urls
    url(r'^', include('webserver.home.urls')),
    url(r'^', include('webserver.profiles.urls')),
    url(r'^', include('webserver.codemanagement.urls')),

    # Competition
    url(r'^', include('competition.urls')),

    # Django AllAuth
    url(r'^accounts/', include('allauth.urls')),

    # Zinnia Blog
    url(r'^weblog/', include('zinnia.urls')),
    url(r'^comments/', include('django.contrib.comments.urls')),

    # Django Admin
    url(r'^admin/', include(admin.site.urls)),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin_tools/', include('admin_tools.urls')),
)

# Flat pages
urlpatterns += patterns(
    'django.contrib.flatpages.views',
    url(r'^(?P<url>.*)$', 'flatpage'),
)

if settings.DEBUG:
    urlpatterns += patterns(
        '',
        url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
            {'document_root': settings.MEDIA_ROOT}),
        url(r'^static/(?P<path>.*)$', 'django.views.static.serve',
            {'document_root': settings.STATIC_ROOT}),
    )

@@ -814,126 +814,8 @@
 %0A)%0A%0A
-# Flat pages%0Aurlpatterns += patterns(%0A    'django.contrib.flatpages.views',%0A    url(r'%5E(?P%3Curl%3E.*)$', 'flatpage'),%0A)%0A%0A
 if s
@@ -981,24 +981,44 @@
 s.MEDIA_ROOT
+,'show_indexes':True
 %7D),%0A        
@@ -1134,10 +1134,129 @@
 %7D),%0A
-
     )%0A
+%0A# Flat pages%0Aurlpatterns += patterns(%0A    'django.contrib.flatpages.views',%0A    url(r'%5E(?P%3Curl%3E.*)$', 'flatpage'),%0A)%0A%0A

Fix that makes the media uploads work correctly.