diff --git a/.travis.yml b/.travis.yml index 8f581d54..d7ad002e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: python +cache: pip + python: # - "2.7.9" - "3.6.7" diff --git a/requirements/base.txt b/requirements/base.txt index ebecaf4a..90bc020b 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -2,7 +2,7 @@ wheel==0.34.2 Django==1.11.28 django-appconf==1.0.4 -django-axes==4.4.2 +django-axes==5.3.2 django-crispy-forms==1.9.1 django-ipware==2.1.0 diff --git a/requirements/production.txt b/requirements/production.txt index ff1b9bf8..dae3e6d1 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -1,2 +1,2 @@ -r base.txt -psycopg2-binary==2.8.4 +psycopg2-binary==2.8.5 diff --git a/requirements/test.txt b/requirements/test.txt index d8c27cdc..febdf33c 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,5 +1,5 @@ -r base.txt -psycopg2-binary==2.8.4 +psycopg2-binary==2.8.5 django-jenkins==0.110.0 factory-boy==2.12.0 diff --git a/src/ionescu77v2Project/settings/base.py b/src/ionescu77v2Project/settings/base.py index 0e083b8f..4076f5e8 100644 --- a/src/ionescu77v2Project/settings/base.py +++ b/src/ionescu77v2Project/settings/base.py @@ -13,7 +13,7 @@ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # Quick-start development settings - unsuitable for production @@ -40,23 +40,41 @@ 'django.contrib.staticfiles', ) -MIDDLEWARE_CLASSES = ( +# MIDDLEWARE_CLASSES = ( +# 'django.contrib.sessions.middleware.SessionMiddleware', +# 'django.middleware.common.CommonMiddleware', +# 'django.middleware.csrf.CsrfViewMiddleware', +# 'django.contrib.auth.middleware.AuthenticationMiddleware', +# 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', +# 'django.contrib.messages.middleware.MessageMiddleware', +# 'django.middleware.clickjacking.XFrameOptionsMiddleware', +# 'django.middleware.security.SecurityMiddleware', +# ) + +MIDDLEWARE = [ + # The following is the list of default middleware in new Django projects. + 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'django.middleware.security.SecurityMiddleware', -) + + # AxesMiddleware should be the last middleware in the MIDDLEWARE list. + # It only formats user lockout messages and renders Axes lockout responses + # on failed user authentication attempts from login views. + # If you do not want Axes to override the authentication response + # you can skip installing the middleware and use your own views. + 'axes.middleware.AxesMiddleware', +] ROOT_URLCONF = 'ionescu77v2Project.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(os.path.dirname(BASE_DIR), 'templates')], + 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -98,8 +116,55 @@ USE_TZ = True +# This should go into all settings files: +# +INSTALLED_APPS += ( + 'landing', + 'blogengine', + 'accounts', + 'django.contrib.sites', + 'django.contrib.flatpages', + 'django.contrib.syndication', + 'django.contrib.sitemaps', + 'crispy_forms', + 'axes', +) + + +# This is for django axes, we'll se how it works local +# +# /////// +# ------- django-axes: CACHES enabled, 20181119 +# ------- django-axes: CACHES enabled, 20200531 +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', + }, + 'axes_cache': { + 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', + } +} +# ------- # + +# /////// +# ------- django-axes: Settings for this: +AXES_CACHE = 'axes_cache' +AXES_VERBOSE = False +AXES_LOCKOUT_TEMPLATE = 'lockout.html' +AUTHENTICATION_BACKENDS = [ + 'axes.backends.AxesBackend', + 'django.contrib.auth.backends.ModelBackend', +] + +# ------- # + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' + +# Added to handle static +# +STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static") +MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "media") diff --git a/src/ionescu77v2Project/settings/local.py b/src/ionescu77v2Project/settings/local.py new file mode 100644 index 00000000..0b2cc649 --- /dev/null +++ b/src/ionescu77v2Project/settings/local.py @@ -0,0 +1,29 @@ +import os +from .base import * + +SECRET_KEY=os.environ['SECRET_KEY_RAZ'] + +DEBUG = True +# TEMPLATE_DEBUG = True # Deprecated see below TEMPLATES: +DISQUS = False + + +ALLOWED_HOSTS = ['127.0.0.1'] + +SITE_ID = 2 + +#TEST_DATABASE_CHARSET=UTF8 +#CHARSET=UTF8 # supported for PG and MySQL only + + +INSTALLED_APPS += ('django_jenkins',) +JENKINS_TASKS = () + +PROJECT_APPS = ['blogengine'] + +CRISPY_TEMPLATE_PACK = 'bootstrap3' + +# /////// +# ------- django-axes: Settings for this: +AXES_VERBOSE = True +# ------- # diff --git a/src/ionescu77v2Project/settings/production.py b/src/ionescu77v2Project/settings/production.py index f49fd231..faf5f9d1 100644 --- a/src/ionescu77v2Project/settings/production.py +++ b/src/ionescu77v2Project/settings/production.py @@ -24,30 +24,16 @@ # TEMPLATE_DEBUG = True # Deprecated see below TEMPLATES: DISQUS = True -ALLOWED_HOSTS = ['ionescu77.com'] - -INSTALLED_APPS += ( - 'landing', - 'blogengine', - 'accounts', - 'django.contrib.sites', - 'django.contrib.flatpages', - 'django.contrib.syndication', - 'django.contrib.sitemaps', - 'crispy_forms', - 'axes', -) +ALLOWED_HOSTS = ['ionescu77.com','www.ionescu77.com','staging.ionescu77.com'] SITE_ID = 1 #TEST_DATABASE_CHARSET=UTF8 #CHARSET=UTF8 # supported for PG and MySQL only -STATIC_ROOT = '/home/ionescu77/webapps/apollo13/ionescu77/static/' -MEDIA_ROOT = '/home/ionescu77/webapps/apollo13/ionescu77/media/' - CRISPY_TEMPLATE_PACK = 'bootstrap3' +# /////// +# ------- django-axes: Settings for this: AXES_VERBOSE = False - -AXES_LOCKOUT_TEMPLATE = 'lockout.html' +# ------- # diff --git a/src/ionescu77v2Project/settings/razvansky.py b/src/ionescu77v2Project/settings/razvansky.py deleted file mode 100644 index 007050ea..00000000 --- a/src/ionescu77v2Project/settings/razvansky.py +++ /dev/null @@ -1,59 +0,0 @@ -import os -from .base import * - -SECRET_KEY=os.environ['SECRET_KEY_RAZ'] - -DEBUG = True -# TEMPLATE_DEBUG = True # Deprecated see below TEMPLATES: -DISQUS = False - - -ALLOWED_HOSTS = ['127.0.0.1'] - -INSTALLED_APPS += ( - 'landing', - 'blogengine', - 'accounts', - 'django.contrib.sites', - 'django.contrib.flatpages', - 'django.contrib.syndication', - 'django.contrib.sitemaps', - 'crispy_forms', - 'axes', -) - -SITE_ID = 2 - -#TEST_DATABASE_CHARSET=UTF8 -#CHARSET=UTF8 # supported for PG and MySQL only - -# /////// -# ------- django-axes: CACHES enabled, 20181119 -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', - }, - 'axes_cache': { - 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', - } -} -# ------- # - -INSTALLED_APPS += ('django_jenkins',) -JENKINS_TASKS = () - -PROJECT_APPS = ['blogengine'] - -CRISPY_TEMPLATE_PACK = 'bootstrap3' - -# /////// -# ------- django-axes: Settings for this: -AXES_CACHE = 'axes_cache' -AXES_VERBOSE = True -AXES_LOCKOUT_TEMPLATE = 'lockout.html' -AUTHENTICATION_BACKENDS = [ - 'axes.backends.AxesModelBackend', - 'django.contrib.auth.backends.ModelBackend', -] - -# ------- # diff --git a/src/ionescu77v2Project/settings/staging.py b/src/ionescu77v2Project/settings/staging.py index 5585959d..b40011bd 100644 --- a/src/ionescu77v2Project/settings/staging.py +++ b/src/ionescu77v2Project/settings/staging.py @@ -26,28 +26,14 @@ ALLOWED_HOSTS = ['ionescu77.staging.avproiect.com'] -INSTALLED_APPS += ( - 'landing', - 'blogengine', - 'accounts', - 'django.contrib.sites', - 'django.contrib.flatpages', - 'django.contrib.syndication', - 'django.contrib.sitemaps', - 'crispy_forms', - 'axes', -) - SITE_ID = 1 #TEST_DATABASE_CHARSET=UTF8 #CHARSET=UTF8 # supported for PG and MySQL only -STATIC_ROOT = '/home/ionescu77/webapps/apollo7/ionescu77/static/' -MEDIA_ROOT = '/home/ionescu77/webapps/apollo7/ionescu77/media/' - CRISPY_TEMPLATE_PACK = 'bootstrap3' -AXES_VERBOSE = False - -AXES_LOCKOUT_TEMPLATE = 'lockout.html' +# /////// +# ------- django-axes: Settings for this: +AXES_VERBOSE = True +# ------- # diff --git a/src/ionescu77v2Project/settings/travis.py b/src/ionescu77v2Project/settings/travis.py index d79ffc96..c0d2165f 100644 --- a/src/ionescu77v2Project/settings/travis.py +++ b/src/ionescu77v2Project/settings/travis.py @@ -9,35 +9,11 @@ ALLOWED_HOSTS = ['127.0.0.1'] -INSTALLED_APPS += ( - 'landing', - 'blogengine', - 'accounts', - 'django.contrib.sites', - 'django.contrib.flatpages', - 'django.contrib.syndication', - 'django.contrib.sitemaps', - 'crispy_forms', - 'axes', -) - SITE_ID = 1 #TEST_DATABASE_CHARSET=UTF8 #CHARSET=UTF8 # supported for PG and MySQL only -# /////// -# ------- django-axes: CACHES enabled, 20181119 -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', - }, - 'axes_cache': { - 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', - } -} -# ------- # - INSTALLED_APPS += ('django_jenkins',) JENKINS_TASKS = () @@ -47,12 +23,5 @@ # /////// # ------- django-axes: Settings for this: -AXES_CACHE = 'axes_cache' -AXES_VERBOSE = True -AXES_LOCKOUT_TEMPLATE = 'lockout.html' -AUTHENTICATION_BACKENDS = [ - 'axes.backends.AxesModelBackend', - 'django.contrib.auth.backends.ModelBackend', -] - +AXES_VERBOSE = False # ------- #