oxdata/oxdata/urls.py

56 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
import os
from django.conf.urls import url, include
from oxdjango.http import HttpFileResponse
from django.conf import settings
import django.views.static
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
import oxdjango.api.urls
import views
import poster.urls
import lookup.urls
def serve_static_file(path, location, content_type):
return HttpFileResponse(location, content_type=content_type)
urlpatterns = [
url(r'^$', views.index),
url(r'^api/?', include(oxdjango.api.urls)),
url(r'^poster/', include(poster.urls)),
url(r'^still/$', poster.views.still),
url(r'^id/', include(lookup.urls)),
url(r'^get/', include(lookup.urls)),
url(r'^robots.txt$', serve_static_file, {
'location': os.path.join(settings.STATIC_ROOT, 'robots.txt'),
'content_type': 'text/plain'
}),
url(r'^favicon.ico$', serve_static_file, {
'location': os.path.join(settings.STATIC_ROOT, 'favicon.ico'),
'content_type': 'image/x-icon'}),
url(r'^admin/', include(admin.site.urls)),
]
if settings.DEBUG:
urlpatterns += [
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}),
]
#load local urls if present
try:
from local_urls import urlpatterns as local_patterns
urlpatterns += local_patterns
except ImportError:
pass