2014-12-04 11:11:46 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.conf import settings
|
|
|
|
from django.conf.urls import patterns, include, url
|
|
|
|
from django.conf.urls.static import static
|
|
|
|
from django.views.generic import TemplateView
|
|
|
|
|
|
|
|
from django.contrib import admin
|
|
|
|
admin.autodiscover()
|
|
|
|
|
2015-09-09 04:28:33 +00:00
|
|
|
|
2015-09-06 01:22:06 +00:00
|
|
|
##################################
|
|
|
|
#
|
|
|
|
# V1 API setup using Tastypie
|
|
|
|
#
|
|
|
|
##################################
|
2014-12-04 11:11:46 +00:00
|
|
|
|
2015-09-09 04:28:33 +00:00
|
|
|
from tastypie.api import Api
|
|
|
|
|
2014-12-15 10:13:52 +00:00
|
|
|
from pokemon.api import (
|
2014-12-04 11:11:46 +00:00
|
|
|
PokemonResource, TypeResource, AbilityResource, GameResource,
|
|
|
|
SpriteResource, DescriptionResource, EggResource, MoveResource,
|
|
|
|
PokedexResource
|
|
|
|
)
|
|
|
|
|
|
|
|
api_resources = Api()
|
|
|
|
api_resources.register(PokemonResource())
|
|
|
|
api_resources.register(AbilityResource())
|
|
|
|
api_resources.register(TypeResource())
|
|
|
|
api_resources.register(GameResource())
|
|
|
|
api_resources.register(SpriteResource())
|
|
|
|
api_resources.register(DescriptionResource())
|
|
|
|
api_resources.register(EggResource())
|
|
|
|
api_resources.register(MoveResource())
|
|
|
|
api_resources.register(PokedexResource())
|
|
|
|
|
|
|
|
|
2015-09-06 01:22:06 +00:00
|
|
|
#####################################
|
|
|
|
#
|
|
|
|
# V2 API setup using Django Rest
|
|
|
|
#
|
|
|
|
#####################################
|
|
|
|
|
|
|
|
from rest_framework import routers
|
2015-09-09 04:28:33 +00:00
|
|
|
from pokemon_v2.views import *
|
2015-09-06 01:22:06 +00:00
|
|
|
|
|
|
|
router = routers.DefaultRouter()
|
|
|
|
|
|
|
|
router.register(r"ability", AbilityResource)
|
2015-09-09 04:28:33 +00:00
|
|
|
router.register(r"generation", GenerationResource)
|
2015-09-10 23:02:06 +00:00
|
|
|
router.register(r"language", LanguageResource)
|
2015-09-09 04:28:33 +00:00
|
|
|
router.register(r"move", MoveResource)
|
|
|
|
router.register(r"nature", NatureResource)
|
2015-09-15 12:26:47 +00:00
|
|
|
router.register(r"pokedex", PokedexResource)
|
2015-09-09 04:28:33 +00:00
|
|
|
router.register(r"pokemon", PokemonResource)
|
2015-09-12 04:53:46 +00:00
|
|
|
router.register(r"region", RegionResource)
|
2015-09-09 04:28:33 +00:00
|
|
|
router.register(r"type", TypeResource)
|
2015-09-12 04:53:46 +00:00
|
|
|
router.register(r"version", VersionResource)
|
|
|
|
router.register(r"version-group", VersionGroupResource)
|
2015-09-06 01:22:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
###########################
|
|
|
|
#
|
|
|
|
# Gotta Get Em' All
|
|
|
|
#
|
|
|
|
###########################
|
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
urlpatterns = patterns(
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
'',
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
url(r'^$', 'config.views.home'),
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
url(r'^docs/$',
|
|
|
|
TemplateView.as_view(template_name='pages/docs.html'),
|
|
|
|
name="documentation"),
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
url(r'^about/$', 'config.views.about'),
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
url(r'^admin/', include(admin.site.urls)),
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
url(r'^api/', include(api_resources.urls)),
|
2015-09-06 01:22:06 +00:00
|
|
|
|
|
|
|
url(r'^api/v2/', include(router.urls)),
|
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
url(r'^media/(?P<path>.*)',
|
|
|
|
'django.views.static.serve',
|
|
|
|
{'document_root': settings.MEDIA_ROOT}),
|
2015-09-06 01:22:06 +00:00
|
|
|
|
2014-12-04 11:11:46 +00:00
|
|
|
url(r'^static/(?P<path>.*)',
|
|
|
|
'django.views.static.serve',
|
|
|
|
{'document_root': settings.STATIC_ROOT}),
|
|
|
|
|
|
|
|
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|