Skip to content

Commit 21a1d4b

Browse files
committed
initial commit
0 parents  commit 21a1d4b

File tree

894 files changed

+777197
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

894 files changed

+777197
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.pyc
2+
*/media/*
3+
*/static/*
4+
*.DS_STORE
5+
db.*
6+
venv*

CONTRIBUTORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Paul Hallett [email protected]

LICENSE.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Copyright (c) 2014, Paul Hallett
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
6+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7+
8+
* 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.
9+
10+
* 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.
11+
12+
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.

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
install:
2+
sudo pip install -r requirements.txt
3+
4+
setup:
5+
python manage.py migrate --settings=config.local
6+
python manage.py loaddata dev_data.json --settings=config.local
7+
8+
wipe_db:
9+
rm -rf db.sqlite3
10+
11+
serve:
12+
python manage.py runserver --settings=config.local
13+
14+
test:
15+
python manage.py test pokemon --settings=config.local
16+
17+
clean:
18+
rm -rf *.pyc

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# PokeAPI
2+
3+
4+
A RESTful API for Pokemon
5+
6+
7+
LICENSE: BSD
8+
9+
http://pokeapi.co
10+
11+
12+
## DEPRECATION
13+
14+
Quite a lot of data is missing from the V1 API.
15+
16+
**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.**
17+
18+
## Setup
19+
20+
1. Download this source code into a working directory.
21+
22+
2. Install the requirements using pip::
23+
24+
$ make install
25+
26+
This will install all the required packages and libraries for using PokeAPI
27+
28+
3. Set up the local developer environment using the following command::
29+
30+
$ make setup
31+
32+
4. Run the server using the following command::
33+
34+
$ make serve
35+
36+
Visit localhost:8000 to see the running website!
37+
38+
If you ever need to wipe the database use this command::
39+
40+
$ make wipe_db

assets/css/bootstrap-theme.min.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/bootstrap.min.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/custom.css

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
.header {
2+
text-align: center;
3+
padding-top:120px;
4+
}
5+
6+
.footer {
7+
padding:30px;
8+
}
9+
10+
.navbar {
11+
background: #c0392b;
12+
}
13+
14+
.center {
15+
text-align: center;
16+
}
17+
18+
.pad_top {
19+
padding-top: 15px;
20+
}
21+
22+
.twitter-tweet {
23+
margin: 0 auto !important;
24+
padding-top: 12px !important;
25+
padding-bottom: 12px !important;
26+
}
27+
28+
.twitter-share-button {
29+
float: left !important;
30+
width: 85px !important;
31+
}
32+
33+
.fb-like {
34+
float: left!important;
35+
}
36+
37+
.navbar-brand {
38+
width:100px;
39+
}
40+
41+
.navbar-inverse .navbar-nav > .active > a,
42+
.navbar-inverse .navbar-nav > .active > a:hover,
43+
.navbar-inverse .navbar-nav > .active > a:focus {
44+
color: #ffffff;
45+
background: #c0392b!important;
46+
}
47+
48+
hr {
49+
border-top: 1px solid #95a5a6;
50+
border-bottom: 1px solid #2c3e50;
51+
}
52+
53+
hr .light {
54+
border-top: 1px solid #ecf0f1;
55+
border-bottom: 1px solid #bdc3c7;
56+
}

assets/favicon.ico

318 Bytes
Binary file not shown.
19.8 KB
Binary file not shown.

assets/fonts/glyphicons-halflings-regular.svg

Lines changed: 229 additions & 0 deletions
Loading
40.3 KB
Binary file not shown.
22.7 KB
Binary file not shown.

assets/js/bootstrap.min.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/jquery.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/__init__.py

Whitespace-only changes.

config/local.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from settings import *
2+
3+
DATABASES = {
4+
'default': {
5+
'ENGINE': 'django.db.backends.sqlite3',
6+
'NAME': os.path.join(PROJECT_ROOT, 'db.sqlite3'),
7+
}
8+
}
9+
10+
DEBUG = True
11+
TASTYPIE_FULL_DEBUG = True

config/settings.py

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Production settings
2+
from unipath import Path
3+
import os
4+
5+
PROJECT_ROOT = Path(__file__).ancestor(2)
6+
7+
8+
DEBUG = False
9+
TEMPLATE_DEBUG = DEBUG
10+
11+
ADMINS = (
12+
('Paul Hallett', '[email protected]'),
13+
)
14+
15+
MANAGERS = ADMINS
16+
17+
# Hosts/domain names that are valid for this site; required if DEBUG is False
18+
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
19+
ALLOWED_HOSTS = ['.pokeapi.co']
20+
21+
TIME_ZONE = 'Europe/London'
22+
23+
LANGUAGE_CODE = 'en-gb'
24+
25+
SITE_ID = 1
26+
27+
# If you set this to False, Django will make some optimizations so as not
28+
# to load the internationalization machinery.
29+
USE_I18N = True
30+
31+
# If you set this to False, Django will not format dates, numbers and
32+
# calendars according to the current locale.
33+
USE_L10N = True
34+
35+
# If you set this to False, Django will not use timezone-aware datetimes.
36+
USE_TZ = True
37+
38+
MEDIA_ROOT = PROJECT_ROOT.child('media')
39+
40+
MEDIA_URL = '/media/'
41+
42+
STATIC_ROOT = PROJECT_ROOT.child('static')
43+
44+
STATIC_URL = '/static/'
45+
46+
STATICFILES_DIRS = (
47+
PROJECT_ROOT.child('assets'),
48+
)
49+
50+
STATICFILES_FINDERS = (
51+
'django.contrib.staticfiles.finders.FileSystemFinder',
52+
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
53+
'django.contrib.staticfiles.finders.DefaultStorageFinder',
54+
)
55+
56+
SECRET_KEY = '4nksdock439320df*(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#'
57+
58+
TEMPLATE_LOADERS = (
59+
'django.template.loaders.filesystem.Loader',
60+
'django.template.loaders.app_directories.Loader',
61+
'django.template.loaders.eggs.Loader',
62+
)
63+
64+
MIDDLEWARE_CLASSES = (
65+
'django.middleware.common.CommonMiddleware',
66+
'django.contrib.sessions.middleware.SessionMiddleware',
67+
'django.middleware.csrf.CsrfViewMiddleware',
68+
'django.contrib.auth.middleware.AuthenticationMiddleware',
69+
'django.contrib.messages.middleware.MessageMiddleware',
70+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
71+
)
72+
73+
ROOT_URLCONF = 'config.urls'
74+
75+
WSGI_APPLICATION = 'config.wsgi.application'
76+
77+
TEMPLATE_DIRS = (
78+
PROJECT_ROOT.child('templates'),
79+
80+
)
81+
82+
DATABASES = {
83+
'default': {
84+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
85+
'NAME': 'pokeapi_co_db',
86+
'USER': 'root',
87+
'PASSWORD': 'pokeapi',
88+
'HOST': 'localhost',
89+
'PORT': '',
90+
}
91+
}
92+
93+
CACHES = {
94+
'default': {
95+
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
96+
'TIMEOUT': 30
97+
},
98+
'resources': {
99+
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
100+
'TIMEOUT': 360
101+
}
102+
}
103+
104+
SECRET_KEY = os.environ.get(
105+
'SECRET_KEY',
106+
'ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#')
107+
108+
109+
CUSTOM_APPS = (
110+
'tastypie',
111+
'pokemon_v1',
112+
'hits',
113+
)
114+
INSTALLED_APPS = (
115+
'django.contrib.auth',
116+
'django.contrib.contenttypes',
117+
'django.contrib.sessions',
118+
'django.contrib.sites',
119+
'django.contrib.staticfiles',
120+
'django.contrib.admin',
121+
'django.contrib.humanize',
122+
) + CUSTOM_APPS
123+
124+
125+
API_LIMIT_PER_PAGE = 1
126+
127+
TASTYPIE_DEFAULT_FORMATS = ['json']

config/urls.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.conf import settings
5+
from django.conf.urls import patterns, include, url
6+
from django.conf.urls.static import static
7+
from django.views.generic import TemplateView
8+
9+
# Uncomment the next two lines to enable the admin:
10+
from django.contrib import admin
11+
admin.autodiscover()
12+
13+
14+
# API v1
15+
from pokemon_v1.api import (
16+
PokemonResource, TypeResource, AbilityResource, GameResource,
17+
SpriteResource, DescriptionResource, EggResource, MoveResource,
18+
PokedexResource
19+
)
20+
21+
from tastypie.api import Api
22+
23+
api_resources = Api()
24+
api_resources.register(PokemonResource())
25+
api_resources.register(AbilityResource())
26+
api_resources.register(TypeResource())
27+
api_resources.register(GameResource())
28+
api_resources.register(SpriteResource())
29+
api_resources.register(DescriptionResource())
30+
api_resources.register(EggResource())
31+
api_resources.register(MoveResource())
32+
api_resources.register(PokedexResource())
33+
34+
35+
urlpatterns = patterns(
36+
'',
37+
url(r'^$', 'config.views.home'),
38+
url(r'^docs/$',
39+
TemplateView.as_view(template_name='pages/docs.html'),
40+
name="documentation"),
41+
url(r'^about/$', 'config.views.about'),
42+
url(r'^admin/', include(admin.site.urls)),
43+
url(r'^api/', include(api_resources.urls)),
44+
url(r'^media/(?P<path>.*)',
45+
'django.views.static.serve',
46+
{'document_root': settings.MEDIA_ROOT}),
47+
url(r'^static/(?P<path>.*)',
48+
'django.views.static.serve',
49+
{'document_root': settings.STATIC_ROOT}),
50+
51+
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

0 commit comments

Comments
 (0)