aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-07 21:03:11 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-07 21:03:11 +0100
commit2e21f37eaf031300b4f7ec0626333255f16e7bd0 (patch)
tree420922015307fde6156345a942f383313f7df180
parent2947010fe6fe3d54019164f9d8213a2fede55a45 (diff)
big update! got working on gcloud and with log and new navbar
-rw-r--r--.gcloudignore21
-rw-r--r--app.yaml18
-rw-r--r--config/ctrack.dbbin0 -> 536576 bytes
-rw-r--r--config/settings/base.py11
-rw-r--r--config/settings/gcloud_settings.py267
-rw-r--r--config/wsgi.py7
-rw-r--r--ctrack/templates/account/login.html33
-rw-r--r--ctrack/templates/base.html218
-rw-r--r--ctrack/templates/pages/home.html38
-rw-r--r--ctrack/users/adapters.py10
-rw-r--r--main.py10
-rwxr-xr-xmanage.py2
-rw-r--r--requirements.txt5
13 files changed, 442 insertions, 198 deletions
diff --git a/.gcloudignore b/.gcloudignore
new file mode 100644
index 0000000..badbd10
--- /dev/null
+++ b/.gcloudignore
@@ -0,0 +1,21 @@
+# This file specifies files that are *not* uploaded to Google Cloud Platform
+# using gcloud. It follows the same syntax as .gitignore, with the addition of
+# "#!include" directives (which insert the entries of the given .gitignore-style
+# file at that point).
+#
+# For more information, run:
+# $ gcloud topic gcloudignore
+#
+.gcloudignore
+# If you would like to upload your .git directory, .gitignore file or files
+# from your .gitignore file, remove the corresponding line
+# below:
+.git
+.gitignore
+.venv
+utility/
+
+# Python pycache:
+__pycache__/
+# Ignored by the build system
+/setup.cfg
diff --git a/app.yaml b/app.yaml
new file mode 100644
index 0000000..f16bfd0
--- /dev/null
+++ b/app.yaml
@@ -0,0 +1,18 @@
+# [START django_app]
+runtime: python38
+
+env_variables:
+ DATABASE_PASSWORD: "mexpuswigmexpuswig"
+
+handlers:
+# This configures Google App Engine to serve the files in the app's static
+# directory.
+- url: /static
+ static_dir: static/
+
+# This handler routes all requests not caught above to your main app. It is
+# required when static routes are defined, but can be omitted (along with
+# the entire handlers section) when there are no static files defined.
+- url: /.*
+ script: auto
+# [END django_app]
diff --git a/config/ctrack.db b/config/ctrack.db
new file mode 100644
index 0000000..4c139dc
--- /dev/null
+++ b/config/ctrack.db
Binary files differ
diff --git a/config/settings/base.py b/config/settings/base.py
index c699798..e3a93a0 100644
--- a/config/settings/base.py
+++ b/config/settings/base.py
@@ -1,6 +1,7 @@
"""
Base settings to build other settings files upon.
"""
+import os
import environ
@@ -40,8 +41,12 @@ LOCALE_PATHS = [ROOT_DIR.path("locale")]
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
-DATABASES = {"default": env.db("DATABASE_URL", default="postgres:///ctrack")}
-DATABASES["default"]["ATOMIC_REQUESTS"] = True
+import pymysql # noqa: 402
+pymysql.version_info = (1, 4, 6, 'final', 0) # change mysqlclient version
+pymysql.install_as_MySQLdb()
+
+# DATABASES = {"default": env.db("DATABASE_URL", default="postgres:///ctrack")}
+# DATABASES["default"]["ATOMIC_REQUESTS"] = True
# URLS
# ------------------------------------------------------------------------------
@@ -68,7 +73,7 @@ DJANGO_APPS = [
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.messages",
- "django_pdb", ## this needs to be before django.contrib.staticfiles according to its docs
+ # "django_pdb", ## this needs to be before django.contrib.staticfiles according to its docs
"django.contrib.staticfiles",
# "django.contrib.humanize", # Handy template tags
"django.contrib.admin",
diff --git a/config/settings/gcloud_settings.py b/config/settings/gcloud_settings.py
index 253a76b..c7c2680 100644
--- a/config/settings/gcloud_settings.py
+++ b/config/settings/gcloud_settings.py
@@ -1,41 +1,150 @@
-# Copyright 2015 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+"""
+Django settings for mysite project.
+
+Generated by 'django-admin startproject' using Django 2.1.1.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/2.1/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/2.1/ref/settings/
+"""
-# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
+import environ
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ROOT_DIR = environ.Path(__file__) - 3 # (ctrack/config/settings/base.py - 3 = ctrack/)
+APPS_DIR = ROOT_DIR.path("ctrack")
+
+
+# STATIC
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#static-root
+STATIC_ROOT = str(ROOT_DIR("static"))
+# https://docs.djangoproject.com/en/dev/ref/settings/#static-url
+STATIC_URL = "/static/"
+# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
+STATICFILES_DIRS = [str(APPS_DIR.path("static"))]
+# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
+STATICFILES_FINDERS = [
+ "django.contrib.staticfiles.finders.FileSystemFinder",
+ "django.contrib.staticfiles.finders.AppDirectoriesFinder",
+]
+
+# MEDIA
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#media-root
+MEDIA_ROOT = str(APPS_DIR("media"))
+# https://docs.djangoproject.com/en/dev/ref/settings/#media-url
+MEDIA_URL = "/media/"
+
+# TEMPLATES
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#templates
+TEMPLATES = [
+ {
+ # https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
+ # https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
+ "DIRS": [str(APPS_DIR.path("templates"))],
+ "OPTIONS": {
+ # https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
+ # https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
+ "loaders": [
+ "django.template.loaders.filesystem.Loader",
+ "django.template.loaders.app_directories.Loader",
+ ],
+ # https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
+ "context_processors": [
+ "django.template.context_processors.debug",
+ "django.template.context_processors.request",
+ "django.contrib.auth.context_processors.auth",
+ "django.template.context_processors.i18n",
+ "django.template.context_processors.media",
+ "django.template.context_processors.static",
+ "django.template.context_processors.tz",
+ "django.contrib.messages.context_processors.messages",
+ "ctrack.utils.context_processors.settings_context",
+ ],
+ },
+ }
+]
+# http://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs
+CRISPY_TEMPLATE_PACK = "bootstrap4"
+
+# FIXTURES
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#fixture-dirs
+FIXTURE_DIRS = (str(APPS_DIR.path("fixtures")),)
+
+# https://docs.djangoproject.com/en/dev/ref/settings/#site-id
+SITE_ID = 1
+
# Quick-start development settings - unsuitable for production
-# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
+# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = 'pf-@jxtojga)z+4s*uwbgjrq$aep62-thd0q7f&o77xtpka!_m'
+# Update the secret key to a value of your own before deploying the app.
+SECRET_KEY = 'lldtg$9(wi49j_hpv8nnqlh!cj7kmbwq0$rj7vy(b(b30vlyzj'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
-# SECURITY WARNING: If you deploy a Django app to production, make sure to set
-# an appropriate host here.
-# See https://docs.djangoproject.com/en/1.10/ref/settings/
+# SECURITY WARNING: App Engine's security features ensure that it is safe to
+# have ALLOWED_HOSTS = ['*'] when the app is deployed. If you deploy a Django
+# app not on App Engine, make sure to set an appropriate host here.
+# See https://docs.djangoproject.com/en/2.1/ref/settings/
ALLOWED_HOSTS = ['*']
+# https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model
+AUTH_USER_MODEL = "users.User"
+
+ROOT_DIR = environ.Path(__file__) - 3 # (ctrack/config/settings/base.py - 3 = ctrack/)
+APPS_DIR = ROOT_DIR.path("ctrack")
+env = environ.Env()
+
+READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=True)
+if READ_DOT_ENV_FILE:
+ # OS environment variables take precedence over variables from .env
+ env.read_env(str(ROOT_DIR.path(".env")))
+
+# MEDIA
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#media-root
+MEDIA_ROOT = str(APPS_DIR("media"))
+# https://docs.djangoproject.com/en/dev/ref/settings/#media-url
+MEDIA_URL = "/media/"
+
+# Django Admin URL.
+ADMIN_URL = "admin/"
+# https://docs.djangoproject.com/en/dev/ref/settings/#admins
+ADMINS = [("""Matt Lemon""", "matt@matthewlemon.com")]
+# https://docs.djangoproject.com/en/dev/ref/settings/#managers
+MANAGERS = ADMINS
+
+# STATIC
+# ------------------------------------------------------------------------------
+# https://docs.djangoproject.com/en/dev/ref/settings/#static-root
+STATIC_ROOT = str(ROOT_DIR("static"))
+# https://docs.djangoproject.com/en/dev/ref/settings/#static-url
+STATIC_URL = "/static/"
+# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
+STATICFILES_DIRS = [str(APPS_DIR.path("static"))]
+# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
+STATICFILES_FINDERS = [
+ "django.contrib.staticfiles.finders.FileSystemFinder",
+ "django.contrib.staticfiles.finders.AppDirectoriesFinder",
+]
+
# Application definition
-INSTALLED_APPS = (
+INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
+ 'django.contrib.sites',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
@@ -43,15 +152,16 @@ INSTALLED_APPS = (
'crispy_forms',
'allauth',
'allauth.account',
+ "allauth.socialaccount",
"ctrack.users.apps.UsersConfig",
"ctrack.organisations.apps.OrganisationsConfig",
"ctrack.caf.apps.CafConfig",
"ctrack.register.apps.RegisterConfig",
"ctrack.assessments.apps.AssessmentsConfig",
"ctrack.core.apps.CoreConfig",
-)
+]
-MIDDLEWARE = (
+MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
@@ -59,49 +169,81 @@ MIDDLEWARE = (
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
-)
-
-ROOT_URLCONF = 'mysite.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',
- ],
- },
- },
]
+ROOT_URLCONF = 'config.urls'
+
+WSGI_APPLICATION = 'config.wsgi.application'
-WSGI_APPLICATION = "config.wsgi.application"
# Database
-# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
-
-# [START dbconfig]
-DATABASES = {
- 'default': {
- # If you are using Cloud SQL for MySQL rather than PostgreSQL, set
- # 'ENGINE': 'django.db.backends.mysql' instead of the following.
- 'ENGINE': 'django.db.backends.postgresql',
- 'NAME': 'ctrack',
- 'USER': os.getenv('DATABASE_USER'),
- 'PASSWORD': os.getenv('DATABASE_PASSWORD'),
- 'HOST': '127.0.0.1',
- 'PORT': '5432',
+# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
+
+# Install PyMySQL as mysqlclient/MySQLdb to use Django's mysqlclient adapter
+# See https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-db-api-drivers
+# for more information
+import pymysql # noqa: 402
+pymysql.version_info = (1, 4, 6, 'final', 0) # change mysqlclient version
+pymysql.install_as_MySQLdb()
+
+# [START db_setup]
+if os.getenv('GAE_APPLICATION', None):
+ # Running on production App Engine, so connect to Google Cloud SQL using
+ # the unix socket at /cloudsql/<your-cloudsql-connection string>
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.mysql',
+ 'HOST': '/cloudsql/ctrack-291710:europe-west2:ctrack-alt',
+ 'USER': 'ctrack',
+ 'PASSWORD': os.getenv('DATABASE_PASSWORD'),
+ 'NAME': 'ctrack',
+ }
+ }
+else:
+ # Running locally so connect to either a local MySQL instance or connect to
+ # Cloud SQL via the proxy. To start the proxy via command line:
+ #
+ # $ cloud_sql_proxy -instances=[INSTANCE_CONNECTION_NAME]=tcp:3306
+ #
+ # See https://cloud.google.com/sql/docs/mysql-connect-proxy
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'ctrack.db'),
+ }
}
-}
-# [END dbconfig]
+# [END db_setup]
+
+# Use a in-memory sqlite3 database when testing in CI systems
+if os.getenv('TRAMPOLINE_CI', None):
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3')
+ }
+ }
+
+# Password validation
+# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', # noqa: 501
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', # noqa: 501
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', # noqa: 501
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', # noqa: 501
+ },
+]
+
# Internationalization
-# https://docs.djangoproject.com/en/1.8/topics/i18n/
+# https://docs.djangoproject.com/en/2.1/topics/i18n/
LANGUAGE_CODE = 'en-gb'
@@ -113,12 +255,9 @@ USE_L10N = True
USE_TZ = True
-# Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/1.8/howto/static-files/
-# [START staticurl]
-#STATIC_URL = '/static/'
-STATIC_URL = 'https://storage.googleapis.com/ctrack/static/'
-# [END staticurl]
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/2.1/howto/static-files/
-STATIC_ROOT = 'static/'
+# STATIC_ROOT = 'static'
+# STATIC_URL = '/static/'
diff --git a/config/wsgi.py b/config/wsgi.py
index e0c17b0..c94e859 100644
--- a/config/wsgi.py
+++ b/config/wsgi.py
@@ -28,7 +28,12 @@ sys.path.append(os.path.join(app_path, "ctrack"))
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings.production"
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
+
+if os.getenv('GAE_APPLICATION', None):
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.gcloud_settings")
+else:
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
+
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
diff --git a/ctrack/templates/account/login.html b/ctrack/templates/account/login.html
index c9e292e..570ba2e 100644
--- a/ctrack/templates/account/login.html
+++ b/ctrack/templates/account/login.html
@@ -1,29 +1,30 @@
{% extends "account/base.html" %}
{% load crispy_forms_tags %}
+{% load static %}
{% block head_title %}Sign In{% endblock %}
{% block inner %}
- <div class="container">
- <div class="col-md-12 my-3 p-3 border border-primary rounded">
- <div class="row">
- <div class="col-md-12">
- <h2>Log in</h2>
- <form class="login" method="POST" action="{% url 'account_login' %}">
- {% csrf_token %}
- {{ form|crispy }}
- {% if redirect_field_value %}
- <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
- {% endif %}
- <a class="button secondaryAction" href="{% url 'account_reset_password' %}">Forgot Password?</a>
- <button class="primaryAction btn btn-primary" id="sign_in_button" type="submit">Sign In</button>
- </form>
- </div>
- </div>
+ <div class="container">
+ <div class="col-md-9 my-3 p-3 border border-muted rounded">
+ <div class="row">
+ <div class="col-md-12">
+ <form class="login" method="POST" action="{% url 'account_login' %}">
+ {% csrf_token %}
+ <img class="mb-4 mx-auto text-center" src="{% static "images/ctrack_logo.png" %}" alt="" width="348" height="122">
+ {{ form|crispy }}
+ {% if redirect_field_value %}
+ <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
+ {% endif %}
+ <a class="button secondaryAction" href="{% url 'account_reset_password' %}">Forgot Password?</a>
+ <button class="primaryAction btn btn-primary" id="sign_in_button" type="submit">Sign In</button>
+ </form>
</div>
+ </div>
</div>
+ </div>
{% endblock %}
diff --git a/ctrack/templates/base.html b/ctrack/templates/base.html
index 40d6e5e..c1333a4 100644
--- a/ctrack/templates/base.html
+++ b/ctrack/templates/base.html
@@ -1,24 +1,25 @@
{% load static i18n %}<!DOCTYPE html>
<html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="x-ua-compatible" content="ie=edge">
- <title>{% block title %}ctrack - Department for Transport{% endblock title %}</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="description" content="">
- <meta name="author" content="">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <title>{% block title %}ctrack - Department for Transport{% endblock title %}</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="">
+ <meta name="author" content="">
- <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
- <!--[if lt IE 9]>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
- <![endif]-->
+ <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
+ <!--[if lt IE 9]>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
+ <![endif]-->
- <link rel="icon" href="{% static 'images/favicons/favicon.ico' %}">
+ <link rel="icon" href="{% static 'images/favicons/favicon.ico' %}">
- {% block css %}
+ {% block css %}
<!-- Latest compiled and minified Bootstrap CSS -->
- <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+ <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"
+ integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- Your stuff: Third-party CSS libraries go here -->
@@ -26,109 +27,118 @@
<!-- This file stores project-specific CSS -->
<link href="{% static 'css/project.css' %}" rel="stylesheet">
-{# <link rel="stylesheet" type="text/css" href="css/DataTables/datatables.min.css"/>#}
-{# <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/css/bootstrap.css" />#}
- <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.20/af-2.3.4/b-1.6.1/b-print-1.6.1/cr-1.5.2/r-2.2.3/datatables.min.css"/>
-
- {% endblock %}
-
- </head>
-
- <body>
-
- <div class="mb-1">
- <nav class="navbar lemon-bar navbar-expand-md navbar-light bg-light">
- <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
- <span class="navbar-toggler-icon"></span>
- </button>
- <a id="_title" class="navbar-brand" href="{% url 'core:home' %}">ctrack</a>
-
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
- <ul class="navbar-nav mr-auto">
- <li class="nav-item active">
- <a class="nav-link" href="{% url 'core:home' %}">Home <span class="sr-only">(current)</span></a>
- </li>
- <li class="nav-item active">
- <a href="{% url 'caf:es_list' %}" class="nav-link">Systems in Scope</a>
- </li>
-
- <li class="nav-item-dropdown">
- <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle">
- Organisations
- </a>
- <div class="dropdown-menu" aria-labelledby="navbarDropdown">
- <a href="#" class="dropdown-item"><a href="{% url "organisations:list" %}">Organisations</a></a>
- <a href="#" class="dropdown-item"><a href="{% url "organisations:people" %}">People</a></a>
- <a href="#" class="dropdown-item">Another Action</a>
- <div class="dropdown-divider"></div>
- <a href="#" class="dropdown-item">Something else here</a>
- </div>
- </li>
-
- <li class="nav-item active">
- <a href="{% url 'caf:caf_list' %}" class="nav-link">CAF list</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="{% url 'about' %}">About</a>
- </li>
- {% if request.user.is_authenticated %}
- <li class="nav-item">
- {# URL provided by django-allauth/account/urls.py #}
- <a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a>
- </li>
- <li class="nav-item">
- {# URL provided by django-allauth/account/urls.py #}
- <a class="nav-link" href="{% url 'account_logout' %}">{% trans "Sign Out" %}</a>
- </li>
- {% else %}
- <li class="nav-item">
- {# URL provided by django-allauth/account/urls.py #}
- <a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% trans "Sign In" %}</a>
- </li>
- {% endif %}
- </ul>
- </div>
- </nav>
-
+ {# <link rel="stylesheet" type="text/css" href="css/DataTables/datatables.min.css"/>#}
+ {# <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/css/bootstrap.css" />#}
+ <link rel="stylesheet" type="text/css"
+ href="https://cdn.datatables.net/v/dt/dt-1.10.20/af-2.3.4/b-1.6.1/b-print-1.6.1/cr-1.5.2/r-2.2.3/datatables.min.css"/>
+
+ {% endblock %}
+
+</head>
+
+<body>
+
+<div class="mb-1">
+ <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
+ <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
+ data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
+ aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+ {# <a id="_title" class="navbar-brand" href="{% url 'core:home' %}">ctrack</a>#}
+ <a href="{% url 'core:home' %}"><img src="{% static "images/ctrack_pc_green.png" %}" alt="" height="38" width="55"></a>
+
+ <div class="collapse navbar-collapse" id="navbarSupportedContent">
+ <ul class="navbar-nav mr-auto">
+ <li class="nav-item">
+ <a href="{% url 'caf:es_list' %}" class="nav-link">Systems in Scope</a>
+ </li>
+
+
+ <li class="nav-item dropdown">
+ <a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown" aria-haspopup="true"
+ aria-expanded="false">Dropdown</a>
+ <div class="dropdown-menu" aria-labelledby="dropdown01">
+ <a class="dropdown-item" href="#">Action</a>
+ <a class="dropdown-item" href="#">Another action</a>
+ <a class="dropdown-item" href="#">Something else here</a>
+ </div>
+ </li>
+
+ <li class="nav-item">
+ <a href="{% url 'caf:caf_list' %}" class="nav-link">CAF list</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="{% url 'about' %}">Help</a>
+ </li>
+ {% if request.user.is_authenticated %}
+ <li class="nav-item">
+ {# URL provided by django-allauth/account/urls.py #}
+ <a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% trans "My Profile" %}</a>
+ </li>
+ <li class="nav-item">
+ {# URL provided by django-allauth/account/urls.py #}
+ <a class="nav-link" href="{% url 'account_logout' %}">{% trans "Sign Out" %}</a>
+ </li>
+ {% else %}
+ <li class="nav-item">
+ {# URL provided by django-allauth/account/urls.py #}
+ <a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% trans "Sign In" %}</a>
+ </li>
+ {% endif %}
+ </ul>
</div>
+ </nav>
+
+</div>
- <div class="container">
+<div class="container">
- {% if messages %}
- {% for message in messages %}
- <div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">{{ message }}<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>
- {% endfor %}
- {% endif %}
+ {% if messages %}
+ {% for message in messages %}
+ <div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">{{ message }}
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
+ aria-hidden="true">&times;</span></button>
+ </div>
+ {% endfor %}
+ {% endif %}
- {% block content %}
- <p>Use this document as a way to quick start any new project.</p>
- {% endblock content %}
+ {% block content %}
+ <p>Use this document as a way to quick start any new project.</p>
+ {% endblock content %}
- </div> <!-- /container -->
+</div> <!-- /container -->
- {% block modal %}{% endblock modal %}
+{% block modal %}{% endblock modal %}
- <!-- Le javascript
- ================================================== -->
- <!-- Placed at the end of the document so the pages load faster -->
- {% block javascript %}
+<!-- Le javascript
+================================================== -->
+<!-- Placed at the end of the document so the pages load faster -->
+{% block javascript %}
- <!-- Bootstrap JS and its dependencies-->
- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+ <!-- Bootstrap JS and its dependencies-->
+ <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
+ integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
+ crossorigin="anonymous"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
+ integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
+ crossorigin="anonymous"></script>
+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
+ integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
+ crossorigin="anonymous"></script>
- <!-- Your stuff: Third-party javascript libraries go here -->
+ <!-- Your stuff: Third-party javascript libraries go here -->
- <!-- place project specific Javascript in this file -->
+ <!-- place project specific Javascript in this file -->
- <script src="{% static 'js/project.js' %}"></script>
-{# <script src="{% static 'js/DataTables/datatables.min.js' %}"></script>#}
- <script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.20/af-2.3.4/b-1.6.1/b-print-1.6.1/cr-1.5.2/r-2.2.3/datatables.min.js"></script>
+ <script src="{% static 'js/project.js' %}"></script>
+ {# <script src="{% static 'js/DataTables/datatables.min.js' %}"></script>#}
+ <script type="text/javascript"
+ src="https://cdn.datatables.net/v/dt/dt-1.10.20/af-2.3.4/b-1.6.1/b-print-1.6.1/cr-1.5.2/r-2.2.3/datatables.min.js"></script>
- {% endblock javascript %}
- </body>
+{% endblock javascript %}
+</body>
</html>
diff --git a/ctrack/templates/pages/home.html b/ctrack/templates/pages/home.html
index 324da8e..baa6d9e 100644
--- a/ctrack/templates/pages/home.html
+++ b/ctrack/templates/pages/home.html
@@ -2,6 +2,40 @@
{% block content %}
- <p>THIS IS A TEMPLATE FOR A REGULAR USER</p>
-
+<main role="main">
+
+ <!-- Main jumbotron for a primary marketing message or call to action -->
+ <div class="jumbotron">
+ <div class="container">
+ <h1 class="display-3">ctrack</h1>
+ <p>This is a template for a simple marketing or informational website. It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
+ <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more &raquo;</a></p>
+ </div>
+ </div>
+
+ <div class="container">
+ <!-- Example row of columns -->
+ <div class="row">
+ <div class="col-md-4">
+ <h2>Heading</h2>
+ <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
+ <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
+ </div>
+ <div class="col-md-4">
+ <h2>Heading</h2>
+ <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
+ <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
+ </div>
+ <div class="col-md-4">
+ <h2>Heading</h2>
+ <p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
+ <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
+ </div>
+ </div>
+
+ <hr>
+
+ </div> <!-- /container -->
+
+</main>
{% endblock content %}
diff --git a/ctrack/users/adapters.py b/ctrack/users/adapters.py
index 0d206fa..b75f31a 100644
--- a/ctrack/users/adapters.py
+++ b/ctrack/users/adapters.py
@@ -1,7 +1,5 @@
-from typing import Any
-
from allauth.account.adapter import DefaultAccountAdapter
-from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
+# from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.conf import settings
from django.http import HttpRequest
@@ -11,6 +9,6 @@ class AccountAdapter(DefaultAccountAdapter):
return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)
-class SocialAccountAdapter(DefaultSocialAccountAdapter):
- def is_open_for_signup(self, request: HttpRequest, sociallogin: Any):
- return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)
+# class SocialAccountAdapter(DefaultSocialAccountAdapter):
+# def is_open_for_signup(self, request: HttpRequest, sociallogin: Any):
+# return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)
diff --git a/main.py b/main.py
new file mode 100644
index 0000000..6f2ca31
--- /dev/null
+++ b/main.py
@@ -0,0 +1,10 @@
+from config.wsgi import application
+
+# App Engine by default looks for a main.py file at the root of the app
+# directory with a WSGI-compatible object called app.
+# This file imports the WSGI-compatible object of your Django app,
+# application from mysite/wsgi.py and renames it app so it is discoverable by
+# App Engine without additional configuration.
+# Alternatively, you can add a custom entrypoint field in your app.yaml:
+# entrypoint: gunicorn -b :$PORT mysite.wsgi
+app = application
diff --git a/manage.py b/manage.py
index 81b5e0c..026c694 100755
--- a/manage.py
+++ b/manage.py
@@ -3,7 +3,7 @@ import os
import sys
if __name__ == "__main__":
- os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.gcloud_settings")
try:
from django.core.management import execute_from_command_line
diff --git a/requirements.txt b/requirements.txt
index ad52554..0fba486 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-Django==3.0.2; python_version > '3.5'
+Django==3.1.2; python_version > '3.5'
Django==2.2.9; python_version == '3.5'
Django==1.11.28;python_version < '3.0'
# Uncomment the mysqlclient requirement if you are using MySQL rather than
@@ -18,3 +18,6 @@ factory-boy==3.0.1
django-extensions==2.2.6
django-allauth>=0.41.0
django-environ
+PyMySQL==0.10.1
+mysql-connector-python
+django-crispy-forms==1.9.2