mirror of
https://github.com/MOIS3Y/logs-collector.git
synced 2025-09-13 13:13:01 +02:00
Create: collector models, protect storage, download view
This commit is contained in:
@@ -1,14 +1,3 @@
|
||||
"""
|
||||
Django settings for logs_collector project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 4.2.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.2/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
"""
|
||||
import environ
|
||||
from pathlib import Path
|
||||
|
||||
@@ -22,8 +11,6 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
environ.Env.read_env(BASE_DIR / '.env')
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = env('SECRET_KEY')
|
||||
@@ -32,7 +19,9 @@ SECRET_KEY = env('SECRET_KEY')
|
||||
DEBUG = env('DEBUG')
|
||||
|
||||
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["*"])
|
||||
CSRF_TRUSTED_ORIGINS = env.list("CSRF_TRUSTED_ORIGINS", default=["*"])
|
||||
|
||||
# TODO: required for docker image
|
||||
# CSRF_TRUSTED_ORIGINS = env.list("CSRF_TRUSTED_ORIGINS", default=["*"])
|
||||
|
||||
|
||||
# Application definition
|
||||
@@ -46,6 +35,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.staticfiles',
|
||||
'collector.apps.CollectorConfig', # main app
|
||||
'rest_framework',
|
||||
'django_cleanup.apps.CleanupConfig', # required bottom
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
@@ -130,3 +120,9 @@ STATIC_URL = 'static/'
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
MEDIA_ROOT = BASE_DIR / 'media'
|
||||
MEDIA_URL = 'media/'
|
||||
|
||||
MEDIA_ROOT_FOR_SENSITIVE_FILES = BASE_DIR / 'archives'
|
||||
MEDIA_URL_FOR_SENSITIVE_FILES = '/archives/'
|
||||
|
@@ -14,9 +14,20 @@ Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import path, include
|
||||
|
||||
from logs_collector import settings
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', include('collector.urls')),
|
||||
]
|
||||
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(
|
||||
settings.MEDIA_URL, document_root=settings.MEDIA_ROOT
|
||||
)
|
||||
|
Reference in New Issue
Block a user