From a52bfc1b8a606fe288ce4f347e5f1a3d99f046b1 Mon Sep 17 00:00:00 2001
From: Bastien Abadie <bastien@nextcairn.com>
Date: Tue, 17 Oct 2017 13:06:39 +0200
Subject: [PATCH] Empty django project

---
 .gitignore            |   2 +
 requirements.txt      |   4 ++
 src/horae/__init__.py |   0
 src/horae/api.py      |   5 ++
 src/horae/settings.py | 143 ++++++++++++++++++++++++++++++++++++++++++
 src/horae/urls.py     |   8 +++
 src/horae/wsgi.py     |  16 +++++
 src/manage.py         |  22 +++++++
 8 files changed, 200 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 requirements.txt
 create mode 100644 src/horae/__init__.py
 create mode 100644 src/horae/api.py
 create mode 100644 src/horae/settings.py
 create mode 100644 src/horae/urls.py
 create mode 100644 src/horae/wsgi.py
 create mode 100755 src/manage.py

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..8d57cafe09
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.pyc
+db.sqlite3
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000000..9681517bf5
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+Django==1.11.6
+djangorestframework==3.7.1
+pkg-resources==0.0.0
+pytz==2017.2
diff --git a/src/horae/__init__.py b/src/horae/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/horae/api.py b/src/horae/api.py
new file mode 100644
index 0000000000..ba1c226c18
--- /dev/null
+++ b/src/horae/api.py
@@ -0,0 +1,5 @@
+from django.conf.urls import url, include
+
+
+urlpatterns = [
+]
diff --git a/src/horae/settings.py b/src/horae/settings.py
new file mode 100644
index 0000000000..314d85d8a9
--- /dev/null
+++ b/src/horae/settings.py
@@ -0,0 +1,143 @@
+"""
+Django settings for horae project.
+
+Generated by 'django-admin startproject' using Django 1.11.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.11/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.11/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__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'jf0w^y&ml(caax8f&a1mub)(js9(l5mhbbhosz3gi+m01ex+lo'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+    'django.contrib.admin',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+
+    # Tools
+    'rest_framework',
+]
+
+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 = 'horae.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 = 'horae.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+    }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/1.11/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/1.11/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/1.11/howto/static-files/
+
+STATIC_URL = '/static/'
+
+# API
+REST_FRAMEWORK = {
+    'DEFAULT_PERMISSION_CLASSES': (
+        'rest_framework.permissions.IsAuthenticated',
+    ),
+    'DEFAULT_AUTHENTICATION_CLASSES': (
+        'rest_framework.authentication.SessionAuthentication',
+    ),
+    # 'PAGE_SIZE': 20,
+}
+
+# Elastic search config
+ELASTIC_SEARCH_HOSTS = ['localhost', ]
+
+# Local settings
+try:
+    from .local_settings import *
+except ImportError:
+    pass
diff --git a/src/horae/urls.py b/src/horae/urls.py
new file mode 100644
index 0000000000..845b90f7be
--- /dev/null
+++ b/src/horae/urls.py
@@ -0,0 +1,8 @@
+from django.conf.urls import url, include
+from django.contrib import admin
+from horae.api import urlpatterns as api
+
+urlpatterns = [
+    url(r'^api/', include(api, namespace='api')),
+    url(r'^admin/', admin.site.urls),
+]
diff --git a/src/horae/wsgi.py b/src/horae/wsgi.py
new file mode 100644
index 0000000000..8a61f1d3bf
--- /dev/null
+++ b/src/horae/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for horae project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "horae.settings")
+
+application = get_wsgi_application()
diff --git a/src/manage.py b/src/manage.py
new file mode 100755
index 0000000000..5354ec25c3
--- /dev/null
+++ b/src/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "horae.settings")
+    try:
+        from django.core.management import execute_from_command_line
+    except ImportError:
+        # The above import may fail for some other reason. Ensure that the
+        # issue is really that Django is missing to avoid masking other
+        # exceptions on Python 2.
+        try:
+            import django
+        except ImportError:
+            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?"
+            )
+        raise
+    execute_from_command_line(sys.argv)
-- 
GitLab