сделал конфиг проекта и зависимости

This commit is contained in:
Андрей Дувакин 2024-04-09 20:22:22 +05:00
parent 6992be122d
commit f60efd4052
7 changed files with 225 additions and 46 deletions

144
.gitignore vendored
View File

@ -1,2 +1,146 @@
/Документы/База.drawio
/Документы/ТЗ.docx
#django project
/venv/
/.idea/
/.vscode/
/__pycache__/
/.env/
/.env
/lyceum/db.sqlite3
/erd.txt
/lyceum/send_mail
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
/.dev/
/.prod/
/.test/
/er.txt

View File

@ -1,42 +1,34 @@
"""
Django settings for CineSync 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 os
from pathlib import Path
from dotenv import load_dotenv
# Build paths inside the project like this: BASE_DIR / 'subdir'.
load_dotenv()
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", default="google")
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
DEBUG = os.environ.get("DJANGO_DEBUG", default="false")
DEBUG = DEBUG.lower().strip() in ("true", "yes", "1", "y", "t")
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-!ht+z5!qp#ln(@f%%cqs7yokqa0vk38qe5q%%@a)ga*$pmoxh)'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
AUTH_USER_MODEL = "auth.User"
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'films.apps.FilmsConfig',
'home.apps.HomeConfig',
'tickets.apps.TicketsConfig',
'timetable.apps.TimetableConfig',
'users.apps.UsersConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
"sorl.thumbnail",
"ckeditor",
"django_cleanup.apps.CleanupConfig",
]
MIDDLEWARE = [
@ -49,12 +41,22 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
if DEBUG:
INSTALLED_APPS += [
"debug_toolbar",
]
MIDDLEWARE += [
"debug_toolbar.middleware.DebugToolbarMiddleware",
]
ROOT_URLCONF = 'CineSync.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [
BASE_DIR / "templates",
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@ -67,12 +69,14 @@ TEMPLATES = [
},
]
INTERNAL_IPS = [
"127.0.0.1",
"localhost",
"*",
]
WSGI_APPLICATION = 'CineSync.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
@ -80,10 +84,6 @@ DATABASES = {
}
}
# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
@ -99,11 +99,7 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'ru'
TIME_ZONE = 'UTC'
@ -111,13 +107,16 @@ USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = 'static/'
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "media"
LOGIN_URL = "/users/login/"
LOGIN_REDIRECT_URL = "/"
LOGOUT_REDIRECT_URL = "/users/login/"

View File

@ -1,3 +1,19 @@
from django.db import models
from django.conf import settings
from django.db.models import Model, OneToOneField, CASCADE, DateField, CharField
# Create your models here.
class Profile(Model):
user = OneToOneField(
settings.AUTH_USER_MODEL,
verbose_name='пользователь',
related_name='profile',
related_query_name='profile',
on_delete=CASCADE,
)
birthday = DateField(
null=True,
blank=True,
)
role = CharField(
verbose_name='роль пользователя',
)

3
requirements/dev.txt Normal file
View File

@ -0,0 +1,3 @@
-r prod.txt
black==24.1.1
django-debug-toolbar==4.3.0

6
requirements/prod.txt Normal file
View File

@ -0,0 +1,6 @@
Django==4.2
django-ckeditor==6.7.0
django-cleanup==8.1.0
pillow==10.2.0
python-dotenv~=1.0.1
sorl-thumbnail==12.10.0

11
requirements/test.txt Normal file
View File

@ -0,0 +1,11 @@
-r prod.txt
flake8==7.0.0
flake8-bugbear==24.2.6
flake8-clean-block==0.1.2
flake8-commas==2.1.0
flake8-expression-complexity==0.0.11
flake8-import-order==0.18.2
flake8-quotes==3.3.2
flake8-return==1.2.0
parameterized==0.9.0
pep8-naming==0.13.3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 152 KiB