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-10-03 03:40:21 +00:00
|
|
|
router.register(r"berry", BerryResource)
|
2015-10-06 17:01:32 +00:00
|
|
|
router.register(r"berry-firmness", BerryFirmnessResource)
|
2015-11-10 19:20:06 +00:00
|
|
|
router.register(r"berry-flavor", BerryFlavorResource)
|
2015-10-29 17:45:58 +00:00
|
|
|
router.register(r"characteristic", CharacteristicResource)
|
2015-11-05 14:55:14 +00:00
|
|
|
router.register(r"contest-type", ContestTypeResource)
|
|
|
|
router.register(r"contest-effect", ContestEffectResource)
|
2015-10-03 03:40:21 +00:00
|
|
|
router.register(r"egg-group", EggGroupResource)
|
2015-10-29 17:45:58 +00:00
|
|
|
router.register(r"encounter-method", EncounterMethodResource) # ?
|
2015-11-05 14:55:14 +00:00
|
|
|
router.register(r"encounter-condition", EncounterConditionResource) # ?
|
|
|
|
router.register(r"encounter-condition-value", EncounterConditionValueResource) # ?
|
2015-10-06 17:01:32 +00:00
|
|
|
router.register(r"evolution-chain", EvolutionChainResource)
|
|
|
|
router.register(r"evolution-trigger", EvolutionTriggerResource)
|
2015-09-09 04:28:33 +00:00
|
|
|
router.register(r"generation", GenerationResource)
|
2015-11-08 21:26:02 +00:00
|
|
|
router.register(r"gender", GenderResource)
|
2015-09-27 04:20:19 +00:00
|
|
|
router.register(r"growth-rate", GrowthRateResource)
|
2015-10-03 03:40:21 +00:00
|
|
|
router.register(r"item", ItemResource)
|
|
|
|
router.register(r"item-category", ItemCategoryResource)
|
2015-10-23 04:56:01 +00:00
|
|
|
router.register(r"item-attribute", ItemAttributeResource)
|
2015-10-03 03:40:21 +00:00
|
|
|
router.register(r"item-fling-effect", ItemFlingEffectResource)
|
|
|
|
router.register(r"item-pocket", ItemPocketResource)
|
2015-09-10 23:02:06 +00:00
|
|
|
router.register(r"language", LanguageResource)
|
2015-10-06 17:01:32 +00:00
|
|
|
router.register(r"location", LocationResource)
|
2015-11-16 03:29:30 +00:00
|
|
|
router.register(r"location-area", LocationAreaResource)
|
2015-09-09 04:28:33 +00:00
|
|
|
router.register(r"move", MoveResource)
|
2015-09-27 04:20:19 +00:00
|
|
|
router.register(r"move-ailment", MoveMetaAilmentResource)
|
2015-11-08 21:26:02 +00:00
|
|
|
router.register(r"move-battle-style", MoveBattleStyleResource)
|
2015-09-27 04:20:19 +00:00
|
|
|
router.register(r"move-category", MoveMetaCategoryResource)
|
|
|
|
router.register(r"move-damage-class", MoveDamageClassResource)
|
|
|
|
router.register(r"move-learn-method", MoveLearnMethodResource)
|
|
|
|
router.register(r"move-target", MoveTargetResource)
|
2015-09-09 04:28:33 +00:00
|
|
|
router.register(r"nature", NatureResource)
|
2015-11-08 21:26:02 +00:00
|
|
|
router.register(r"pal-park-area", PalParkAreaResource)
|
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-12-02 00:01:17 +00:00
|
|
|
router.register(r"pokemon-color", PokemonColorResource)
|
|
|
|
router.register(r"pokemon-form", PokemonFormResource)
|
2015-10-03 03:40:21 +00:00
|
|
|
router.register(r"pokemon-habitat", PokemonHabitatResource)
|
2015-09-19 22:13:41 +00:00
|
|
|
router.register(r"pokemon-shape", PokemonShapeResource)
|
2015-10-03 03:40:21 +00:00
|
|
|
router.register(r"pokemon-species", PokemonSpeciesResource)
|
2015-11-08 21:26:02 +00:00
|
|
|
router.register(r"pokeathlon-stat", PokeathlonStatResource)
|
2015-09-12 04:53:46 +00:00
|
|
|
router.register(r"region", RegionResource)
|
2015-09-27 04:20:19 +00:00
|
|
|
router.register(r"stat", StatResource)
|
2015-11-05 14:55:14 +00:00
|
|
|
router.register(r"super-contest-effect", SuperContestEffectResource)
|
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)
|