-
-
Notifications
You must be signed in to change notification settings - Fork 974
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autoformat entire project, tidy up makefile
- Loading branch information
Showing
17 changed files
with
10,552 additions
and
5,841 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
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 |
---|---|---|
@@ -1,29 +1,38 @@ | ||
install: | ||
.PHONY: help | ||
|
||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?# "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
|
||
install: # Install base requirements to run project | ||
pip install -r requirements.txt | ||
|
||
dev-install: | ||
dev-install: # Install developer requirements + base requirements | ||
pip install -r test-requirements.txt | ||
|
||
lint: | ||
pylint config data pokemon_v2 --load-plugins pylint_django | ||
|
||
setup: | ||
setup: # Set up the project database | ||
python manage.py migrate --settings=config.local | ||
|
||
wipe_db: | ||
wipe_db: # Delete's the project database | ||
rm -rf db.sqlite3 | ||
|
||
serve: | ||
serve: # Run the project locally | ||
python manage.py runserver --settings=config.local | ||
|
||
test: | ||
test: # Run tests | ||
python manage.py test --settings=config.local | ||
|
||
clean: | ||
clean: # Remove any pyc files | ||
find . -type f -name '*.pyc' -delete | ||
|
||
migrate: | ||
migrate: # run any outstanding migrations | ||
python manage.py migrate --settings=config.local | ||
|
||
shell: | ||
shell: # Load a shell | ||
python manage.py shell --settings=config.local | ||
|
||
format: # Format the source code | ||
black . | ||
|
||
format-check: # Check the source code has been formatted | ||
black . --check |
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
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
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 |
---|---|---|
@@ -1,17 +1,13 @@ | ||
from .settings import * | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': os.path.join(PROJECT_ROOT, 'db.sqlite3'), | ||
"default": { | ||
"ENGINE": "django.db.backends.sqlite3", | ||
"NAME": os.path.join(PROJECT_ROOT, "db.sqlite3"), | ||
} | ||
} | ||
|
||
CACHES = { | ||
'default': { | ||
'BACKEND': 'django.core.cache.backends.dummy.DummyCache', | ||
} | ||
} | ||
CACHES = {"default": {"BACKEND": "django.core.cache.backends.dummy.DummyCache",}} | ||
|
||
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 |
---|---|---|
|
@@ -8,23 +8,21 @@ | |
|
||
TEMPLATE_DEBUG = DEBUG | ||
|
||
ADMINS = ( | ||
('Paul Hallett', '[email protected]'), | ||
) | ||
ADMINS = (("Paul Hallett", "[email protected]"),) | ||
|
||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' | ||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" | ||
|
||
MANAGERS = ADMINS | ||
|
||
BASE_URL = 'http://pokeapi.co' | ||
BASE_URL = "http://pokeapi.co" | ||
|
||
# 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', 'localhost', '127.0.0.1'] | ||
ALLOWED_HOSTS = [".pokeapi.co", "localhost", "127.0.0.1"] | ||
|
||
TIME_ZONE = 'Europe/London' | ||
TIME_ZONE = "Europe/London" | ||
|
||
LANGUAGE_CODE = 'en-gb' | ||
LANGUAGE_CODE = "en-gb" | ||
|
||
SITE_ID = 1 | ||
|
||
|
@@ -40,91 +38,80 @@ | |
USE_TZ = True | ||
|
||
# Explicitly define test runner to avoid warning messages on test execution | ||
TEST_RUNNER = 'django.test.runner.DiscoverRunner' | ||
TEST_RUNNER = "django.test.runner.DiscoverRunner" | ||
|
||
SECRET_KEY = '4nksdock439320df*(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#' | ||
SECRET_KEY = "4nksdock439320df*(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#" | ||
|
||
MIDDLEWARE = [ | ||
'corsheaders.middleware.CorsMiddleware', | ||
'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', | ||
"corsheaders.middleware.CorsMiddleware", | ||
"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' | ||
ROOT_URLCONF = "config.urls" | ||
|
||
WSGI_APPLICATION = 'config.wsgi.application' | ||
WSGI_APPLICATION = "config.wsgi.application" | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'NAME': 'pokeapi_co_db', | ||
'USER': 'root', | ||
'PASSWORD': 'pokeapi', | ||
'HOST': 'localhost', | ||
'PORT': '', | ||
'CONN_MAX_AGE': 30 | ||
"default": { | ||
"ENGINE": "django.db.backends.postgresql_psycopg2", | ||
"NAME": "pokeapi_co_db", | ||
"USER": "root", | ||
"PASSWORD": "pokeapi", | ||
"HOST": "localhost", | ||
"PORT": "", | ||
"CONN_MAX_AGE": 30, | ||
} | ||
} | ||
|
||
CACHES = { | ||
"default": { | ||
"BACKEND": "django_redis.cache.RedisCache", | ||
"LOCATION": "redis://127.0.0.1:6379/1", | ||
"OPTIONS": { | ||
"CLIENT_CLASS": "django_redis.client.DefaultClient", | ||
} | ||
"OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient",}, | ||
} | ||
} | ||
|
||
SECRET_KEY = os.environ.get( | ||
'SECRET_KEY', | ||
'ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#') | ||
"SECRET_KEY", "ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#" | ||
) | ||
|
||
CUSTOM_APPS = ( | ||
'tastypie', | ||
'pokemon_v2', | ||
"tastypie", | ||
"pokemon_v2", | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
'django.contrib.admin', | ||
'django.contrib.humanize', | ||
'corsheaders', | ||
'rest_framework', | ||
'cachalot' | ||
"django.contrib.auth", | ||
"django.contrib.contenttypes", | ||
"django.contrib.sessions", | ||
"django.contrib.sites", | ||
"django.contrib.admin", | ||
"django.contrib.humanize", | ||
"corsheaders", | ||
"rest_framework", | ||
"cachalot", | ||
) + CUSTOM_APPS | ||
|
||
|
||
API_LIMIT_PER_PAGE = 1 | ||
|
||
TASTYPIE_DEFAULT_FORMATS = ['json'] | ||
TASTYPIE_DEFAULT_FORMATS = ["json"] | ||
|
||
CORS_ORIGIN_ALLOW_ALL = True | ||
|
||
CORS_ALLOW_METHODS = ( | ||
'GET' | ||
) | ||
CORS_ALLOW_METHODS = "GET" | ||
|
||
CORS_URLS_REGEX = r'^/api/.*$' | ||
CORS_URLS_REGEX = r"^/api/.*$" | ||
|
||
REST_FRAMEWORK = { | ||
'DEFAULT_RENDERER_CLASSES': ( | ||
'drf_ujson.renderers.UJSONRenderer', | ||
), | ||
'DEFAULT_PARSER_CLASSES': ( | ||
'drf_ujson.renderers.UJSONRenderer', | ||
), | ||
|
||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', | ||
|
||
'PAGE_SIZE': 20, | ||
|
||
'PAGINATE_BY': 20 | ||
"DEFAULT_RENDERER_CLASSES": ("drf_ujson.renderers.UJSONRenderer",), | ||
"DEFAULT_PARSER_CLASSES": ("drf_ujson.renderers.UJSONRenderer",), | ||
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", | ||
"PAGE_SIZE": 20, | ||
"PAGINATE_BY": 20, | ||
} |
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
Oops, something went wrong.