pokeapi/config/urls.py

127 lines
4.2 KiB
Python
Raw Normal View History

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-06 01:22:06 +00:00
##################################
#
# V1 API setup using Tastypie
#
##################################
2014-12-04 11:11:46 +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
from pokemon_v2.views import *
2015-09-06 01:22:06 +00:00
router = routers.DefaultRouter()
router.register(r"ability", AbilityResource)
router.register(r"berry", BerryResource)
2015-10-06 17:01:32 +00:00
router.register(r"berry-firmness", BerryFirmnessResource)
router.register(r"characteristic", CharacteristicResource)
router.register(r"contest-type", ContestTypeResource)
router.register(r"contest-effect", ContestEffectResource)
router.register(r"egg-group", EggGroupResource)
router.register(r"encounter-method", EncounterMethodResource) # ?
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)
router.register(r"generation", GenerationResource)
router.register(r"growth-rate", GrowthRateResource)
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)
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)
router.register(r"location-area", LocationAreaResource) # ?
router.register(r"move", MoveResource)
router.register(r"move-ailment", MoveMetaAilmentResource)
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)
router.register(r"nature", NatureResource)
router.register(r"pokedex", PokedexResource)
router.register(r"pokemon", PokemonResource)
router.register(r"pokemon-habitat", PokemonHabitatResource)
router.register(r"pokemon-shape", PokemonShapeResource)
router.register(r"pokemon-species", PokemonSpeciesResource)
router.register(r"pokemon-color", PokemonColorResource)
2015-10-06 17:01:32 +00:00
router.register(r"pokemon-form", PokemonFormResource)
router.register(r"region", RegionResource)
router.register(r"stat", StatResource)
router.register(r"super-contest-effect", SuperContestEffectResource)
router.register(r"type", TypeResource)
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)