forked from PokeAPI/pokeapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 21a1d4b
Showing
894 changed files
with
777,197 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.pyc | ||
*/media/* | ||
*/static/* | ||
*.DS_STORE | ||
db.* | ||
venv* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Paul Hallett [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Copyright (c) 2014, Paul Hallett | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the name of pokeapi nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
install: | ||
sudo pip install -r requirements.txt | ||
|
||
setup: | ||
python manage.py migrate --settings=config.local | ||
python manage.py loaddata dev_data.json --settings=config.local | ||
|
||
wipe_db: | ||
rm -rf db.sqlite3 | ||
|
||
serve: | ||
python manage.py runserver --settings=config.local | ||
|
||
test: | ||
python manage.py test pokemon --settings=config.local | ||
|
||
clean: | ||
rm -rf *.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# PokeAPI | ||
|
||
|
||
A RESTful API for Pokemon | ||
|
||
|
||
LICENSE: BSD | ||
|
||
http://pokeapi.co | ||
|
||
|
||
## DEPRECATION | ||
|
||
Quite a lot of data is missing from the V1 API. | ||
|
||
**As of January 2015, no new data will be added to the v1 API, you will have to use the V2 API instead. This is part of an ongoing deprecation of the v1 API.** | ||
|
||
## Setup | ||
|
||
1. Download this source code into a working directory. | ||
|
||
2. Install the requirements using pip:: | ||
|
||
$ make install | ||
|
||
This will install all the required packages and libraries for using PokeAPI | ||
|
||
3. Set up the local developer environment using the following command:: | ||
|
||
$ make setup | ||
|
||
4. Run the server using the following command:: | ||
|
||
$ make serve | ||
|
||
Visit localhost:8000 to see the running website! | ||
|
||
If you ever need to wipe the database use this command:: | ||
|
||
$ make wipe_db |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.header { | ||
text-align: center; | ||
padding-top:120px; | ||
} | ||
|
||
.footer { | ||
padding:30px; | ||
} | ||
|
||
.navbar { | ||
background: #c0392b; | ||
} | ||
|
||
.center { | ||
text-align: center; | ||
} | ||
|
||
.pad_top { | ||
padding-top: 15px; | ||
} | ||
|
||
.twitter-tweet { | ||
margin: 0 auto !important; | ||
padding-top: 12px !important; | ||
padding-bottom: 12px !important; | ||
} | ||
|
||
.twitter-share-button { | ||
float: left !important; | ||
width: 85px !important; | ||
} | ||
|
||
.fb-like { | ||
float: left!important; | ||
} | ||
|
||
.navbar-brand { | ||
width:100px; | ||
} | ||
|
||
.navbar-inverse .navbar-nav > .active > a, | ||
.navbar-inverse .navbar-nav > .active > a:hover, | ||
.navbar-inverse .navbar-nav > .active > a:focus { | ||
color: #ffffff; | ||
background: #c0392b!important; | ||
} | ||
|
||
hr { | ||
border-top: 1px solid #95a5a6; | ||
border-bottom: 1px solid #2c3e50; | ||
} | ||
|
||
hr .light { | ||
border-top: 1px solid #ecf0f1; | ||
border-bottom: 1px solid #bdc3c7; | ||
} |
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from settings import * | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': os.path.join(PROJECT_ROOT, 'db.sqlite3'), | ||
} | ||
} | ||
|
||
DEBUG = True | ||
TASTYPIE_FULL_DEBUG = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# Production settings | ||
from unipath import Path | ||
import os | ||
|
||
PROJECT_ROOT = Path(__file__).ancestor(2) | ||
|
||
|
||
DEBUG = False | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
ADMINS = ( | ||
('Paul Hallett', '[email protected]'), | ||
) | ||
|
||
MANAGERS = ADMINS | ||
|
||
# Hosts/domain names that are valid for this site; required if DEBUG is False | ||
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts | ||
ALLOWED_HOSTS = ['.pokeapi.co'] | ||
|
||
TIME_ZONE = 'Europe/London' | ||
|
||
LANGUAGE_CODE = 'en-gb' | ||
|
||
SITE_ID = 1 | ||
|
||
# If you set this to False, Django will make some optimizations so as not | ||
# to load the internationalization machinery. | ||
USE_I18N = True | ||
|
||
# If you set this to False, Django will not format dates, numbers and | ||
# calendars according to the current locale. | ||
USE_L10N = True | ||
|
||
# If you set this to False, Django will not use timezone-aware datetimes. | ||
USE_TZ = True | ||
|
||
MEDIA_ROOT = PROJECT_ROOT.child('media') | ||
|
||
MEDIA_URL = '/media/' | ||
|
||
STATIC_ROOT = PROJECT_ROOT.child('static') | ||
|
||
STATIC_URL = '/static/' | ||
|
||
STATICFILES_DIRS = ( | ||
PROJECT_ROOT.child('assets'), | ||
) | ||
|
||
STATICFILES_FINDERS = ( | ||
'django.contrib.staticfiles.finders.FileSystemFinder', | ||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
'django.contrib.staticfiles.finders.DefaultStorageFinder', | ||
) | ||
|
||
SECRET_KEY = '4nksdock439320df*(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#' | ||
|
||
TEMPLATE_LOADERS = ( | ||
'django.template.loaders.filesystem.Loader', | ||
'django.template.loaders.app_directories.Loader', | ||
'django.template.loaders.eggs.Loader', | ||
) | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
) | ||
|
||
ROOT_URLCONF = 'config.urls' | ||
|
||
WSGI_APPLICATION = 'config.wsgi.application' | ||
|
||
TEMPLATE_DIRS = ( | ||
PROJECT_ROOT.child('templates'), | ||
|
||
) | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'NAME': 'pokeapi_co_db', | ||
'USER': 'root', | ||
'PASSWORD': 'pokeapi', | ||
'HOST': 'localhost', | ||
'PORT': '', | ||
} | ||
} | ||
|
||
CACHES = { | ||
'default': { | ||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', | ||
'TIMEOUT': 30 | ||
}, | ||
'resources': { | ||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', | ||
'TIMEOUT': 360 | ||
} | ||
} | ||
|
||
SECRET_KEY = os.environ.get( | ||
'SECRET_KEY', | ||
'ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#') | ||
|
||
|
||
CUSTOM_APPS = ( | ||
'tastypie', | ||
'pokemon_v1', | ||
'hits', | ||
) | ||
INSTALLED_APPS = ( | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
'django.contrib.staticfiles', | ||
'django.contrib.admin', | ||
'django.contrib.humanize', | ||
) + CUSTOM_APPS | ||
|
||
|
||
API_LIMIT_PER_PAGE = 1 | ||
|
||
TASTYPIE_DEFAULT_FORMATS = ['json'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# -*- 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 | ||
|
||
# Uncomment the next two lines to enable the admin: | ||
from django.contrib import admin | ||
admin.autodiscover() | ||
|
||
|
||
# API v1 | ||
from pokemon_v1.api import ( | ||
PokemonResource, TypeResource, AbilityResource, GameResource, | ||
SpriteResource, DescriptionResource, EggResource, MoveResource, | ||
PokedexResource | ||
) | ||
|
||
from tastypie.api import Api | ||
|
||
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()) | ||
|
||
|
||
urlpatterns = patterns( | ||
'', | ||
url(r'^$', 'config.views.home'), | ||
url(r'^docs/$', | ||
TemplateView.as_view(template_name='pages/docs.html'), | ||
name="documentation"), | ||
url(r'^about/$', 'config.views.about'), | ||
url(r'^admin/', include(admin.site.urls)), | ||
url(r'^api/', include(api_resources.urls)), | ||
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}), | ||
|
||
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
Oops, something went wrong.