TerraNexus Web Application Package¶
The TerraNexus package contains the core configuration components for the TerraNexus Web Application. This includes all of the settings, static files, scripts and base templates used to drive the Django based Web Application.
TerraNexus Web Application Submodules¶
The following submodules are defined by this package.
TerraNexus.asgi module¶
TerraNexus.wsgi module¶
TerraNexus.routing module¶
TerraNexus.urls module¶
Note
Module Details
TerraNexus URL Configuration
The urlpatterns list routes URLs to views. For more information please see: Django Documentation - urls
Examples
Function views:
Add an import:
from my_app import views
Add a URL to urlpatterns:
re_path(r'^$', views.home, name='home')
Class-based views:
Add an import:
from other_app.views import Home
Add a URL to urlpatterns:
re_path(r'^$', Home.as_view(), name='home')
Including another URLconf:
Import the include() function:
from django.conf.urls import url, include
Add a URL to urlpatterns:
re_path(r'^blog/', include('blog.urls'))
Created: 7 September 2017
@author: Dr. Matthew B.J. Purss
TerraNexus.celery module¶
Note
Module Details
Celery Configuration Module
Celery is a distributed task queue for UNIX systems. It allows you to offload work from your Python app. Once you integrate Celery into your app, you can send time-intensive tasks to Celery’s task queue.
Created: 25 January 2018
@author: Dr. Matthew B.J. Purss
TerraNexus.decorators module¶
Note
Module Details
Custom Decorator Functions implemented by TerraNexus
Created: 19 January 2020
@author: Dr. Matthew B.J. Purss
- src.TerraNexus.decorators.check_recaptcha(view_func)¶
Note
Function Details
Decorator Function to check the google reCapture response to verify a USER is not a Computer.
- Parameters:
view_func (function) – The Django View Function this Decorator Function will be applied to
- Returns:
_wrapped_view – A “wrapped” view that includes the Google Recapture site verification object with the response to the calling Django View Function.
- Return type:
view_func
- src.TerraNexus.decorators.task_to_async(task)¶
TerraNexus.storage module¶
Note
Module Details
Static Data Storage Configuration
TerraNexus leverages the WhiteNoise library to efficiently manage the serving of static file content on cloud installations of Django (such as TerraNexus).
Created: 31 May 2020
@author: Dr. Matthew B.J. Purss
TerraNexus Web Application Settings & Security Modules¶
The Settings Modules define the key configuration parameters that drive the TerraNexus Django Web Application. To ensure security of the Web Application, there is also a secret_key_gen module that generates the private security key Django uses to validate Cross-Site Request Forgery (CSRF) Tokens to prevent CSRF Attacks.
TerraNexus.settings.test_settings module¶
Note
Module Details
TerraNexus Django Settings Configuration Module
This module defines the key Django Settings that drive the operation of the TerraNexus Web Application.
Created: 7 September 2017
@author: Dr. Matthew B.J. Purss
TerraNexus.settings.secret_key_gen module¶
Note
Module Details
TerraNexus Secret key Generator Module
This module defines the method to automatically generate the Django Secret Key which is used to validate against Cross-Site Request Forgery (CSRF) attacks.
This module removes the need to store a static secret key as text in the Django Settings File.
Created: 7 September 2017
@author: Dr. Matthew B.J. Purss
- class src.TerraNexus.settings.secret_key_gen.SecretKeyClass(project_settings_dir)¶
Bases:
object
Secret Key Generator Class.
- Parameters:
project_settings_dir (string) – Path to the Django Project Settings File
- get_reCaptcha_key()¶
Function to retrieve the Google reCaptcha Key. This function uses the project_settings_dir parameter to retrieve and decode an encrypted secret key object. If no encrypted key exists one is generated from scratch.
This function is referenced and called from the Django Settings Configuration file to provide a secure value for the CSRF Secret key.
- Returns:
secret_key_dict – Dictionary object containing the Google reCaptcha Key
- Return type:
dict
- get_secret_key()¶
Function to retrieve the TerraNexus Secret Key. This function uses the project_settings_dir parameter to retrieve and decode an encrypted secret key object. If no encrypted key exists one is generated from scratch.
This function is referenced and called from the Django Settings Configuration file to provide a secure value for the CSRF Secret key.
- Returns:
secret_key_dict – Dictionary object containing the TerraNexus Django Secret Key
- Return type:
dict