From d4c07999d0dfe1cb52683b8eea071974ecf2d550 Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Tue, 11 Feb 2020 15:30:12 +0100 Subject: [PATCH 1/4] add Pipfile to keep track of dependencies --- Pipfile | 15 +++++++++ Pipfile.lock | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 Pipfile create mode 100644 Pipfile.lock diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..cd5ea23 --- /dev/null +++ b/Pipfile @@ -0,0 +1,15 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] +psycopg2 = "*" + +[packages] +django = "*" +mercantile = "*" +geojson = "*" + +[requires] +python_version = "3" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..fb79cbb --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,93 @@ +{ + "_meta": { + "hash": { + "sha256": "2b50d6a3840ac9e6f63d430c71b2cf5d97951f998f645c636f42b4ed5d6b3b8e" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "asgiref": { + "hashes": [ + "sha256:7e06d934a7718bf3975acbf87780ba678957b87c7adc056f13b6215d610695a0", + "sha256:ea448f92fc35a0ef4b1508f53a04c4670255a3f33d22a81c8fc9c872036adbe5" + ], + "version": "==3.2.3" + }, + "click": { + "hashes": [ + "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", + "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" + ], + "version": "==7.0" + }, + "django": { + "hashes": [ + "sha256:2f1ba1db8648484dd5c238fb62504777b7ad090c81c5f1fd8d5eb5ec21b5f283", + "sha256:c91c91a7ad6ef67a874a4f76f58ba534f9208412692a840e1d125eb5c279cb0a" + ], + "index": "pypi", + "version": "==3.0.3" + }, + "geojson": { + "hashes": [ + "sha256:6e4bb7ace4226a45d9c8c8b1348b3fc43540658359f93c3f7e03efa9f15f658a", + "sha256:ccbd13368dd728f4e4f13ffe6aaf725b6e802c692ba0dde628be475040c534ba" + ], + "index": "pypi", + "version": "==2.5.0" + }, + "mercantile": { + "hashes": [ + "sha256:6681c0be3b3d8ea1d88d7f9cff56993782fb7de1e9df420ad9c48f93a859394d", + "sha256:6ef7301b8f5b29f622b97f5ab2c43edfa2e1c3857b96adbfc6eac9ec376abe0e" + ], + "index": "pypi", + "version": "==1.1.2" + }, + "pytz": { + "hashes": [ + "sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d", + "sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be" + ], + "version": "==2019.3" + }, + "sqlparse": { + "hashes": [ + "sha256:40afe6b8d4b1117e7dff5504d7a8ce07d9a1b15aeeade8a2d10f130a834f8177", + "sha256:7c3dca29c022744e95b547e867cee89f4fce4373f3549ccd8797d8eb52cdb873" + ], + "version": "==0.3.0" + } + }, + "develop": { + "psycopg2": { + "hashes": [ + "sha256:4212ca404c4445dc5746c0d68db27d2cbfb87b523fe233dc84ecd24062e35677", + "sha256:47fc642bf6f427805daf52d6e52619fe0637648fe27017062d898f3bf891419d", + "sha256:72772181d9bad1fa349792a1e7384dde56742c14af2b9986013eb94a240f005b", + "sha256:8396be6e5ff844282d4d49b81631772f80dabae5658d432202faf101f5283b7c", + "sha256:893c11064b347b24ecdd277a094413e1954f8a4e8cdaf7ffbe7ca3db87c103f0", + "sha256:92a07dfd4d7c325dd177548c4134052d4842222833576c8391aab6f74038fc3f", + "sha256:965c4c93e33e6984d8031f74e51227bd755376a9df6993774fd5b6fb3288b1f4", + "sha256:9ab75e0b2820880ae24b7136c4d230383e07db014456a476d096591172569c38", + "sha256:b0845e3bdd4aa18dc2f9b6fb78fbd3d9d371ad167fd6d1b7ad01c0a6cdad4fc6", + "sha256:dca2d7203f0dfce8ea4b3efd668f8ea65cd2b35112638e488a4c12594015f67b", + "sha256:ed686e5926929887e2c7ae0a700e32c6129abb798b4ad2b846e933de21508151", + "sha256:ef6df7e14698e79c59c7ee7cf94cd62e5b869db369ed4b1b8f7b729ea825712a", + "sha256:f898e5cc0a662a9e12bde6f931263a1bbd350cfb18e1d5336a12927851825bb6" + ], + "index": "pypi", + "version": "==2.8.4" + } + } +} From d626e6fbccebc4cbfd00332e7bbdb713851d2ace Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Tue, 11 Feb 2020 15:30:31 +0100 Subject: [PATCH 2/4] add settings_base and example settings file this was done to document how this django application is configured --- tileservermapping/settings.py.example | 36 +++++++++ tileservermapping/settings_base.py | 103 ++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 tileservermapping/settings.py.example create mode 100644 tileservermapping/settings_base.py diff --git a/tileservermapping/settings.py.example b/tileservermapping/settings.py.example new file mode 100644 index 0000000..e205cd7 --- /dev/null +++ b/tileservermapping/settings.py.example @@ -0,0 +1,36 @@ +""" +Django settings for tileservermapping project. + +Generated by 'django-admin startproject' using Django 2.0.6. + +For more information on this file, see +https://docs.djangoproject.com/en/2.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.0/ref/settings/ +""" +from .settings_base import * + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = None # change this + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS += [ + "localhost" +] + +# Database +# https://docs.djangoproject.com/en/2.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'HOST': 'localhost', + 'PORT': 5432, + 'USER': 'osm_tileservermapping', + 'NAME': 'osm_tileservermapping', + 'PASSWORD': 'osm_tileservermapping' + } +} diff --git a/tileservermapping/settings_base.py b/tileservermapping/settings_base.py new file mode 100644 index 0000000..b758adc --- /dev/null +++ b/tileservermapping/settings_base.py @@ -0,0 +1,103 @@ +""" +Django settings for tileservermapping project. + +Generated by 'django-admin startproject' using Django 2.0.6. + +For more information on this file, see +https://docs.djangoproject.com/en/2.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.0/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +ALLOWED_HOSTS = [ + # override in settings.py +] + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'tileservermapping.mapping', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'tileservermapping.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'tileservermapping.wsgi.application' + +DATABASES = { + # override in settings.py +} + +# Password validation +# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + +# Internationalization +# https://docs.djangoproject.com/en/2.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/2.0/howto/static-files/ + +STATIC_URL = '/static/' From 17c0c68e0e42821422d532079a69cba75c028b18 Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Tue, 11 Feb 2020 15:35:51 +0100 Subject: [PATCH 3/4] add simple readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..508bade --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Tileserver Mapping + +This is a django application whose role it is to keep track of available [Tileservers](https://github.com/Map-Data/regiontileserver), +the region which each one provides data for and route incoming traffic to the correct one. + + From a22ab2949824086a189befaea07dd7ce5cadcb07 Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Wed, 12 Feb 2020 11:08:26 +0100 Subject: [PATCH 4/4] remove obsolete manage.py file --- tileservermapping/manage.py | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100755 tileservermapping/manage.py diff --git a/tileservermapping/manage.py b/tileservermapping/manage.py deleted file mode 100755 index 9ef148e..0000000 --- a/tileservermapping/manage.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python -import os -import sys - -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tileservermapping.settings") - try: - from django.core.management import execute_from_command_line - except ImportError as exc: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) from exc - execute_from_command_line(sys.argv)