First working version

This commit is contained in:
2023-01-15 18:32:05 +01:00
parent 0b7d16d3e0
commit 823470e2f2
37 changed files with 902 additions and 24 deletions
+26 -22
View File
@@ -1,36 +1,34 @@
"""
Django settings for movieclub project.
Generated by 'django-admin startproject' using Django 4.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
import environ
import os
from pathlib import Path
env = environ.Env(
DEBUG=(bool, False),
LANGUAGE_CODE=(str, "en-us"),
TIME_ZONE=(str, "UTC")
)
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
environ.Env.read_env(os.path.join(BASE_DIR, '.env'))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-dkxk-x5l6s(8tt89-gwq+u5)o-qovem0=@a^00=h=*3r+25%^g'
SECRET_KEY = env("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
DEBUG = env('DEBUG')
ALLOWED_HOSTS = env('ALLOWED_HOSTS')
# Application definition
INSTALLED_APPS = [
'watchlist.apps.WatchlistConfig',
'rest_framework',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -39,6 +37,11 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
]
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 100
}
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
@@ -54,7 +57,9 @@ ROOT_URLCONF = 'movieclub.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [
BASE_DIR / "templates"
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@@ -74,10 +79,7 @@ WSGI_APPLICATION = 'movieclub.wsgi.application'
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
'default': env.db()
}
@@ -105,7 +107,7 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Prague'
USE_I18N = True
@@ -115,6 +117,8 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/
STATICFILES_DIRS = [ BASE_DIR / "static"]
STATIC_ROOT = "deploy/static/"
STATIC_URL = 'static/'
# Default primary key field type
+16 -1
View File
@@ -14,8 +14,23 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import include, path, reverse
from django.views.generic.base import RedirectView
from rest_framework import routers, schemas
import auth.urls
import watchlist.urls
urlpatterns = [
path('', RedirectView.as_view(url="/watchlist/"), name="home"),
path('admin/', admin.site.urls),
path('auth/', include(auth.urls)),
path('watchlist/', include(watchlist.urls)),
# path('api/watchlist/', include(watchlist.urls.api_router.urls)),
# path('openapi', schemas.get_schema_view(
# title="Movieclub",
# description="",
# version="0.1.0"
# )),
# path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]