from django.conf import settings
from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'', include('spark.urls')),
    (r'^', include('poster.urls')),
    (r'^', include('sharing.urls')),
    (r'', include('desktop.urls')),
    (r'^m/', include('mobile.urls')),
    (r'^', include('users.urls')),
    
    (r'^admin/', include(admin.site.urls)),
    
    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
)

# Handle 404 and 500 errors
handler404 = 'spark.views.handle404'
handler500 = 'spark.views.handle500'

## In DEBUG mode, serve media files through Django.
if settings.DEBUG:
    # Remove leading and trailing slashes so the regex matches.
    media_url = settings.MEDIA_URL.lstrip('/').rstrip('/')
    urlpatterns += patterns('',
        (r'^%s/(?P<path>.*)$' % media_url, 'django.views.static.serve',
         {'document_root': settings.MEDIA_ROOT}),
    )

from django.conf import settings
from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'', include('spark.urls')),
    (r'^', include('poster.urls')),
    (r'^', include('sharing.urls')),
    (r'', include('desktop.urls')),
    (r'^m/', include('mobile.urls')),
    (r'^', include('users.urls')),
    
    (r'^admin/', include(admin.site.urls)),
    
    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
)

# Handle 404 and 500 errors
handler404 = 'spark.views.handle404'
handler500 = 'spark.views.handle500'

## In DEBUG mode, serve media files through Django.
if settings.DEBUG:
    # Remove leading and trailing slashes so the regex matches.
    media_url = settings.MEDIA_URL.lstrip('/').rstrip('/')
    urlpatterns += patterns('',
        (r'^%s/(?P<path>.*)$' % media_url, 'django.views.static.serve',
         {'document_root': settings.MEDIA_ROOT}),
    )

# Uncomment the admin/doc line below to enable admin documentation: # (r'^admin/doc/', include('django.contrib.admindocs.urls')), # Handle 404 and 500 errors ## In DEBUG mode, serve media files through Django. # Remove leading and trailing slashes so the regex matches.