Add: storage info widget and storage api endpoint refactoring project structure add version app

This commit is contained in:
2023-09-07 13:07:18 +09:00
parent e95de1b553
commit 016994d594
28 changed files with 487 additions and 216 deletions

View File

@@ -0,0 +1,29 @@
"""
An application for uploading archives with log files
for their subsequent download and check issues
that have arisen with software products.
The purpose of creating this application is
the ability to securely exchange and store log files containing sensitive data.
I have not found an application that would allow an unauthorized client
to upload data without providing him with authorization credentials.
You can use other applications for this,
such as Google cloud, Yandex cloud, DropBox etc, but in this case,
you do not have a tool that would allow you to automatically restrict uploads
later until you explicitly deny access to the shared link.
This app allows you to upload files using a unique token
associated with a support ticket.
This token has a limit on the number of file upload attempts.
Also, if the ticket is resolved, then the token is invalid.
"""
# █▀▄▀█ █▀▀ ▀█▀ ▄▀█ ▀
# █░▀░█ ██▄ ░█░ █▀█ ▄
# -------------------
__author__ = "MOIS3Y"
__credits__ = ["Stepan Zhukovsky"]
__license__ = "GPL v3.0"
__version__ = "0.1.0"
__maintainer__ = "Stepan Zhukovsky"
__email__ = "stepan@zhukovsky.me"
__status__ = "Development"

View File

@@ -2,6 +2,7 @@ import environ
from pathlib import Path
from datetime import timedelta
from . import __version__
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -9,6 +10,8 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# Set default environ variables:
env = environ.Env(
# set casting default value
VERSION=(str, __version__),
ENVIRONMENT=(str, 'development'),
DEBUG=(bool, False),
SECRET_KEY=(str, 'j9QGbvM9Z4otb47'),
SQLITE_URL=(str, f'sqlite:///{BASE_DIR / "data/db.sqlite3"}'),
@@ -20,6 +23,9 @@ env = environ.Env(
# Read .env file if exist:
environ.Env.read_env(BASE_DIR / '.env')
VERSION = env('VERSION')
ENVIRONMENT = env('ENVIRONMENT')
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')
@@ -78,10 +84,14 @@ TEMPLATES = [
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
# default:
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
# collector:
'collector.context_processors.metadata',
'collector.context_processors.storage_info',
],
},
},
@@ -174,6 +184,7 @@ REST_FRAMEWORK = {
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
# 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', # noqa:E501
# 'PAGE_SIZE': 3,
'DEFAULT_METADATA_CLASS': 'rest_framework.metadata.SimpleMetadata',
}
if DEBUG: