From 2b01776cac96be57480185d18e053942152937cb Mon Sep 17 00:00:00 2001 From: "Jose E.R" Date: Thu, 9 Nov 2017 22:33:49 +0100 Subject: [PATCH] Split requirements between required by tests and required by demo. --- README.md | 2 +- README.rst | 2 +- dr27demo/dr27app/base_settings.py | 125 ++++++++++++++++++++++++++ dr27demo/dr27app/pytest_settings.py | 19 +--- dr27demo/dr27app/settings.py | 135 +++------------------------- dr27demo/requirements-demo.txt | 13 +++ requirements.txt | 14 +-- 7 files changed, 153 insertions(+), 157 deletions(-) create mode 100644 dr27demo/dr27app/base_settings.py create mode 100644 dr27demo/requirements-demo.txt diff --git a/README.md b/README.md index 62016d0..6c3c41d 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ Demo (virtualenv recommended) $ git clone https://github.com/SRJ9/django-driver27 $ cd django-driver27 # or name of destiny folder $ pip install Django>=1.10 #if is not installed -$ pip install -r requirements.txt +$ pip install -r dr27demo/requirements-demo.txt $ python dr27demo/manage.py runserver $ # login /admin: admin:pass ~~~~ diff --git a/README.rst b/README.rst index 1f66b08..0ec777f 100644 --- a/README.rst +++ b/README.rst @@ -151,7 +151,7 @@ Demo (virtualenv recommended) $ git clone https://github.com/SRJ9/django-driver27 $ cd django-driver27 # or name of destiny folder $ pip install Django>=1.10 #if is not installed - $ pip install -r requirements.txt + $ pip install -r dr27demo/requirements-demo.txt $ python dr27demo/manage.py runserver $ # login /admin: admin:pass diff --git a/dr27demo/dr27app/base_settings.py b/dr27demo/dr27app/base_settings.py new file mode 100644 index 0000000..8c9c339 --- /dev/null +++ b/dr27demo/dr27app/base_settings.py @@ -0,0 +1,125 @@ +""" +Django settings for dr27app project. + +Generated by 'django-admin startproject' using Django 1.10.1. + +For more information on this file, see +https://docs.djangoproject.com/en/1.10/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.10/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.10/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'test_key' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + +# Application definition + +INSTALLED_APPS = [ + 'bootstrap3', + 'driver27', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django_countries', + 'rest_framework', + 'django_filters', +] + +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 = 'dr27demo.dr27app.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 = 'dr27app.wsgi.application' + +# Database +# https://docs.djangoproject.com/en/1.10/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'demo.sqlite3'), + } +} + +# Password validation +# https://docs.djangoproject.com/en/1.10/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.10/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.10/howto/static-files/ + +STATIC_URL = '/static/' +TABBED_ADMIN_USE_JQUERY_UI = True + +COUNTRIES_OVERRIDE = { + 'EU': 'Europe' +} + diff --git a/dr27demo/dr27app/pytest_settings.py b/dr27demo/dr27app/pytest_settings.py index 5252fcd..23df356 100644 --- a/dr27demo/dr27app/pytest_settings.py +++ b/dr27demo/dr27app/pytest_settings.py @@ -1,21 +1,4 @@ -import os -from .settings import * - -# DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.sqlite3', -# 'NAME': os.path.join(BASE_DIR, 'pytest.sqlite3'), -# } -# } +from .base_settings import * PYTEST_SETTING = True ALLOWED_HOSTS.append('testserver') - -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', - 'LOCATION': '127.0.0.1:11211', - 'KEY_PREFIX': 'driver27-demo-test' - - } -} \ No newline at end of file diff --git a/dr27demo/dr27app/settings.py b/dr27demo/dr27app/settings.py index 6deecc6..1bb4272 100644 --- a/dr27demo/dr27app/settings.py +++ b/dr27demo/dr27app/settings.py @@ -1,126 +1,15 @@ -""" -Django settings for dr27app project. +from .base_settings import * -Generated by 'django-admin startproject' using Django 1.10.1. +INSTALLED_APPS = \ + [ + 'flat_responsive', + ] + \ + INSTALLED_APPS + \ + [ -For more information on this file, see -https://docs.djangoproject.com/en/1.10/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.10/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.10/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'test_key' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] - -# Application definition - -INSTALLED_APPS = [ - 'bootstrap3', - 'flat_responsive', - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django_countries', - 'tabbed_admin', - 'rest_framework', - 'django_filters', - 'memcache_status', - 'driver27' -] - -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 = 'dr27demo.dr27app.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 = 'dr27app.wsgi.application' - -# Database -# https://docs.djangoproject.com/en/1.10/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'demo.sqlite3'), - } -} - -# Password validation -# https://docs.djangoproject.com/en/1.10/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.10/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.10/howto/static-files/ - -STATIC_URL = '/static/' -TABBED_ADMIN_USE_JQUERY_UI = True + 'memcache_status', + 'django_clear_memcache' + ] # Append punctuation to tests DR27_CONFIG = { @@ -150,10 +39,6 @@ } } -COUNTRIES_OVERRIDE = { - 'EU': 'Europe' -} - CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', diff --git a/dr27demo/requirements-demo.txt b/dr27demo/requirements-demo.txt new file mode 100644 index 0000000..2748e35 --- /dev/null +++ b/dr27demo/requirements-demo.txt @@ -0,0 +1,13 @@ +-r ../requirements.txt + +# OPTIONAL, USED IN DEMO +python-memcached +django-memcache-status +django-flat-responsive +django_clear_memcache + +# FOR TESTING +tox + +# 2.7 +unicodecsv \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 1064edf..bc399bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ # MANDATORY +six djangorestframework>=3.7.0 django-swapfield django-filter @@ -7,15 +8,4 @@ python-slugify # TEMPLATES django-bootstrap3 - -# OPTIONAL, USED IN DEMO -django-tabbed-admin -python-memcached -django-memcache-status -django-flat-responsive - -# FOR TESTING -tox - -# 2.7 -unicodecsv \ No newline at end of file +django-tabbed-admin \ No newline at end of file