#
# Copyright (c) 2009 Brad Taylor <brad@getcoded.net>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from django.views.generic.simple import direct_to_template, redirect_to
from django.core.urlresolvers import reverse
from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

handler500 = 'snowy.views.server_error'

urlpatterns = patterns('',
    url(r'^$', direct_to_template, {'template': 'index.html'},
        name='snowy_index'),

    (r'^api/', include('snowy.api.urls')),
    (r'^accounts/', include('snowy.accounts.urls')),
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^admin/', include(admin.site.urls)),

    (r'^export/', include('snowy.export.urls')),

    (r'^mobile/', include('snowy.mobile_notes.urls')),

    url(r'^(?P<username>\w+)/$', 'snowy.views.user_index', name="user_index"),
    (r'^(?P<username>\w+)/notes/', include('snowy.notes.urls')),
)

from django.conf import settings

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

# OAuth
urlpatterns += patterns('piston.authentication',
    url(r'^oauth/request_token/$', 'oauth_request_token', name='oauth_request_token'),
    url(r'^oauth/authenticate/$', 'oauth_user_auth', name='oauth_user_auth'),
    url(r'^oauth/access_token/$', 'oauth_access_token', name='oauth_access_token'),
)

@@ -1578,31 +1578,103 @@
 gs%0A%0A
-if settings.DEBUG:%0A    
+# allow serving static assets all the time,%0A# not the best way to do this in prod environments%0A
 urlp
@@ -1701,20 +1701,16 @@
 '',%0A    
-   
- 
 (r'%5Esite
@@ -1771,20 +1771,16 @@
         
-    
 'documen
@@ -1817,20 +1817,16 @@
         
-  
-  
 'show_in
@@ -1837,23 +1837,21 @@
 s': 
-True%0A    
+False%0A
     %7D)
+%0A
 )%0A%0A#

Allow static file serving regardless of DEBUG mode