init commit
This commit is contained in:
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
.env
|
||||||
|
media/
|
||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
0
.history/.env_20250506100502
Normal file
0
.history/.env_20250506100502
Normal file
15
.history/.env_20250506100611
Normal file
15
.history/.env_20250506100611
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
ALLOWED_HOSTS=['0.0.0.0', 'localhost', '127.0.0.1']
|
||||||
|
DEBUG=True
|
||||||
|
DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
|
||||||
|
DATABASE_NAME=postgres
|
||||||
|
DATABASE_USER=postgres
|
||||||
|
DATABASE_PASSWORD=postgres
|
||||||
|
DATABASE_HOST=db
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
15
.history/.env_20250506100702
Normal file
15
.history/.env_20250506100702
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
ALLOWED_HOSTS=['0.0.0.0', 'localhost', '127.0.0.1']
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
|
||||||
|
DATABASE_NAME=postgres
|
||||||
|
DATABASE_USER=postgres
|
||||||
|
DATABASE_PASSWORD=postgres
|
||||||
|
DATABASE_HOST=db
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
15
.history/.env_20250506100747
Normal file
15
.history/.env_20250506100747
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=0.0.0.0, localhost, 127.0.0.1
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://postgres:postgres@db:5432/postgres
|
||||||
|
DATABASE_NAME=postgres
|
||||||
|
DATABASE_USER=postgres
|
||||||
|
DATABASE_PASSWORD=postgres
|
||||||
|
DATABASE_HOST=db
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
16
.history/.env_20250506101009
Normal file
16
.history/.env_20250506101009
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=0.0.0.0, localhost, 127.0.0.1
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=db
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
17
.history/.env_20250506101028
Normal file
17
.history/.env_20250506101028
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=0.0.0.0, localhost, 127.0.0.1
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=postgres
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
17
.history/.env_20250506101344
Normal file
17
.history/.env_20250506101344
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=0.0.0.0, localhost, 127.0.0.1
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=127.0.0.1
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
17
.history/.env_20250506103308
Normal file
17
.history/.env_20250506103308
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=0.0.0.0,localhost,127.0.0.1
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=127.0.0.1
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
17
.history/.env_20250506103333
Normal file
17
.history/.env_20250506103333
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=['0.0.0.0','localhost','127.0.0.1']
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=127.0.0.1
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
17
.history/.env_20250506103411
Normal file
17
.history/.env_20250506103411
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=['0.0.0.0', 'localhost', '127.0.0.1']
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=127.0.0.1
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
17
.history/.env_20250506103426
Normal file
17
.history/.env_20250506103426
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=127.0.0.1
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=127.0.0.1
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
17
.history/.env_20250506103431
Normal file
17
.history/.env_20250506103431
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=0.0.0.0
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=127.0.0.1
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
17
.history/.env_20250506103626
Normal file
17
.history/.env_20250506103626
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=127.0.0.1
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=127.0.0.1
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
18
.history/.env_20250506165303
Normal file
18
.history/.env_20250506165303
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
DJANGO_SECRET_KEY=django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0=
|
||||||
|
DJANGO_ALLOWED_HOSTS=127.0.0.1
|
||||||
|
DJANGO_DEBUG=True
|
||||||
|
DATABASE_URL=postgres://admin:admin@db:5432/links
|
||||||
|
DATABASE_NAME=links
|
||||||
|
DATABASE_USER=admin
|
||||||
|
DATABASE_PASSWORD=admin
|
||||||
|
DATABASE_ENGINE=django.db.backends.postgresql
|
||||||
|
DATABASE_HOST=127.0.0.1
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_DB=0
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
|
NEXT_PUBLIC_API_URL=http://127.0.0.1:8000
|
||||||
3
.history/backend/api/admin_20250506130805.py
Normal file
3
.history/backend/api/admin_20250506130805.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
14
.history/backend/api/admin_20250506131421.py
Normal file
14
.history/backend/api/admin_20250506131421.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
@admin.register(Link)
|
||||||
|
class LinkAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('title', 'url', 'owner', 'group', 'order')
|
||||||
|
list_filter = ('owner', 'group')
|
||||||
|
search_fields = ('title', 'url')
|
||||||
|
|
||||||
|
@admin.register(LinkGroup)
|
||||||
|
class LinkGroupAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name', 'owner', 'order')
|
||||||
|
list_filter = ('owner',)
|
||||||
|
search_fields = ('name',)
|
||||||
15
.history/backend/api/admin_20250506161017.py
Normal file
15
.history/backend/api/admin_20250506161017.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# api/admin.py
|
||||||
|
from django.contrib import admin
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
@admin.register(Link)
|
||||||
|
class LinkAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('title', 'url', 'owner', 'group', 'order')
|
||||||
|
list_filter = ('owner', 'group')
|
||||||
|
search_fields = ('title', 'url')
|
||||||
|
|
||||||
|
@admin.register(LinkGroup)
|
||||||
|
class LinkGroupAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name', 'owner', 'order')
|
||||||
|
list_filter = ('owner',)
|
||||||
|
search_fields = ('name',
|
||||||
17
.history/backend/api/admin_20250506161028.py
Normal file
17
.history/backend/api/admin_20250506161028.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# api/admin.py
|
||||||
|
from django.contrib import admin
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
@admin.register(Link)
|
||||||
|
class LinkAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('title', 'url', 'owner', 'group', 'order')
|
||||||
|
list_filter = ('owner', 'group')
|
||||||
|
search_fields = ('title', 'url')
|
||||||
|
|
||||||
|
@admin.register(LinkGroup)
|
||||||
|
class LinkGroupAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name', 'owner', 'order')
|
||||||
|
list_filter = ('owner',)
|
||||||
|
search_fields = ('name',)
|
||||||
|
ordering = ('owner', 'order')
|
||||||
|
prepopulated_fields = {'slug': ('name',)}
|
||||||
16
.history/backend/api/admin_20250506161445.py
Normal file
16
.history/backend/api/admin_20250506161445.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# api/admin.py
|
||||||
|
from django.contrib import admin
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
@admin.register(Link)
|
||||||
|
class LinkAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('title', 'url', 'owner', 'group', 'order')
|
||||||
|
list_filter = ('owner', 'group')
|
||||||
|
search_fields = ('title', 'url')
|
||||||
|
|
||||||
|
@admin.register(LinkGroup)
|
||||||
|
class LinkGroupAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name', 'owner', 'order')
|
||||||
|
list_filter = ('owner',)
|
||||||
|
search_fields = ('name',)
|
||||||
|
ordering = ('owner', 'order')
|
||||||
3
.history/backend/api/models_20250506130805.py
Normal file
3
.history/backend/api/models_20250506130805.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
22
.history/backend/api/models_20250506130917.py
Normal file
22
.history/backend/api/models_20250506130917.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# api/models.py
|
||||||
|
from django.db import models
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name='groups')
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} - {self.name}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name='links')
|
||||||
|
group = models.ForeignKey(LinkGroup, on_delete=models.SET_NULL, null=True, blank=True, related_name='links')
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
icon = models.URLField(blank=True, null=True)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
35
.history/backend/api/models_20250506131033.py
Normal file
35
.history/backend/api/models_20250506131033.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# api/models.py
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='link_groups' # было 'groups', теперь уникальное имя
|
||||||
|
)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} - {self.name}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links' # оставляем 'links' — у User нет такого поля
|
||||||
|
)
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
null=True, blank=True,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
icon = models.URLField(blank=True, null=True)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
35
.history/backend/api/models_20250506131051.py
Normal file
35
.history/backend/api/models_20250506131051.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# api/models.py
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='link_groups' # было 'groups', теперь уникальное имя
|
||||||
|
)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} - {self.name}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links' # оставляем 'links' — у User нет такого поля
|
||||||
|
)
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
null=True, blank=True,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
icon = models.URLField(blank=True, null=True)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
35
.history/backend/api/models_20250506131102.py
Normal file
35
.history/backend/api/models_20250506131102.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# api/models.py
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='link_groups' # было 'groups', теперь уникальное имя
|
||||||
|
)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} - {self.name}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links' # оставляем 'links' — у User нет такого поля
|
||||||
|
)
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
null=True, blank=True,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
icon = models.URLField(blank=True, null=True)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
34
.history/backend/api/models_20250506131134.py
Normal file
34
.history/backend/api/models_20250506131134.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='link_groups' # было 'groups', теперь уникальное имя
|
||||||
|
)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} - {self.name}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links' # оставляем 'links' — у User нет такого поля
|
||||||
|
)
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
null=True, blank=True,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
icon = models.URLField(blank=True, null=True)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
34
.history/backend/api/models_20250506131224.py
Normal file
34
.history/backend/api/models_20250506131224.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='api_link_groups' # теперь уникально
|
||||||
|
)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} - {self.name}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links' # оставляем 'links' — у User нет такого поля
|
||||||
|
)
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
null=True, blank=True,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
icon = models.URLField(blank=True, null=True)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
35
.history/backend/api/models_20250506160935.py
Normal file
35
.history/backend/api/models_20250506160935.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='link_groups'
|
||||||
|
)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} - {self.name}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
icon = models.URLField(blank=True, null=True)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
35
.history/backend/api/models_20250506161429.py
Normal file
35
.history/backend/api/models_20250506161429.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='api_link_groups' # уникальное имя, чтобы не конфликтовать с links app
|
||||||
|
)
|
||||||
|
name = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} - {self.name}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
icon = models.URLField(blank=True, null=True)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
0
.history/backend/api/serializers_20250506130933.py
Normal file
0
.history/backend/api/serializers_20250506130933.py
Normal file
31
.history/backend/api/serializers_20250506130936.py
Normal file
31
.history/backend/api/serializers_20250506130936.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
from rest_framework import serializers
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
class RegisterSerializer(serializers.ModelSerializer):
|
||||||
|
password = serializers.CharField(write_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
fields = ('username', 'email', 'password')
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
user = User(
|
||||||
|
username=validated_data['username'],
|
||||||
|
email=validated_data.get('email', '')
|
||||||
|
)
|
||||||
|
user.set_password(validated_data['password'])
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
|
||||||
|
class LinkGroupSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = LinkGroup
|
||||||
|
fields = ('id', 'name', 'order')
|
||||||
|
read_only_fields = ('id',)
|
||||||
|
|
||||||
|
class LinkSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Link
|
||||||
|
fields = ('id', 'title', 'url', 'icon', 'order', 'group')
|
||||||
|
read_only_fields = ('id', 'owner')
|
||||||
34
.history/backend/api/serializers_20250506160944.py
Normal file
34
.history/backend/api/serializers_20250506160944.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterSerializer(serializers.ModelSerializer):
|
||||||
|
password = serializers.CharField(write_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
fields = ('username', 'email', 'password')
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
user = User(
|
||||||
|
username=validated_data['username'],
|
||||||
|
email=validated_data.get('email', '')
|
||||||
|
)
|
||||||
|
user.set_password(validated_data['password'])
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
|
||||||
|
class LinkGroupSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = LinkGroup
|
||||||
|
fields = ('id', 'name', 'order')
|
||||||
|
read_only_fields = ('id',)
|
||||||
|
|
||||||
|
class LinkSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Link
|
||||||
|
fields = ('id', 'title', 'url', 'icon', 'order', 'group')
|
||||||
|
read_only_fields = ('id', 'owner')
|
||||||
46
.history/backend/api/serializers_20250506170829.py
Normal file
46
.history/backend/api/serializers_20250506170829.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterSerializer(serializers.ModelSerializer):
|
||||||
|
password = serializers.CharField(write_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
fields = ('username', 'email', 'password')
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
user = User(
|
||||||
|
username=validated_data['username'],
|
||||||
|
email=validated_data.get('email', '')
|
||||||
|
)
|
||||||
|
user.set_password(validated_data['password'])
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
|
||||||
|
class LinkGroupSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = LinkGroup
|
||||||
|
fields = ('id', 'name', 'order')
|
||||||
|
read_only_fields = ('id',)
|
||||||
|
|
||||||
|
class LinkSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Link
|
||||||
|
fields = ('id', 'title', 'url', 'icon', 'order', 'group')
|
||||||
|
read_only_fields = ('id', 'owner')
|
||||||
|
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class UserSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
# поля, которые хотите отдавать на фронт:
|
||||||
|
fields = ['id', 'username', 'email', 'first_name', 'last_name']
|
||||||
55
.history/backend/api/serializers_20250506171300.py
Normal file
55
.history/backend/api/serializers_20250506171300.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterSerializer(serializers.ModelSerializer):
|
||||||
|
password = serializers.CharField(write_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
fields = ('username', 'email', 'password')
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
user = User(
|
||||||
|
username=validated_data['username'],
|
||||||
|
email=validated_data.get('email', '')
|
||||||
|
)
|
||||||
|
user.set_password(validated_data['password'])
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.conf import settings
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
# сериализатор для ссылок
|
||||||
|
class LinkSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Link
|
||||||
|
fields = ['id', 'title', 'url', 'icon', 'order', 'group']
|
||||||
|
|
||||||
|
# сериализатор для групп со вложенными ссылками
|
||||||
|
class LinkGroupSerializer(serializers.ModelSerializer):
|
||||||
|
# related_name у вас в модели LinkGroup.owner = 'api_link_groups',
|
||||||
|
# а у модели Link.group = 'links', так что у группы obj.links — это QuerySet ссылок
|
||||||
|
links = LinkSerializer(many=True, read_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = LinkGroup
|
||||||
|
fields = ['id', 'name', 'order', 'links']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class UserSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
# поля, которые хотите отдавать на фронт:
|
||||||
|
fields = ['id', 'username', 'email', 'first_name', 'last_name']
|
||||||
55
.history/backend/api/serializers_20250506182026.py
Normal file
55
.history/backend/api/serializers_20250506182026.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterSerializer(serializers.ModelSerializer):
|
||||||
|
password = serializers.CharField(write_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
fields = ('username', 'email', 'password')
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
user = User(
|
||||||
|
username=validated_data['username'],
|
||||||
|
email=validated_data.get('email', '')
|
||||||
|
)
|
||||||
|
user.set_password(validated_data['password'])
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.conf import settings
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
# сериализатор для ссылок
|
||||||
|
class LinkSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Link
|
||||||
|
fields = ['id', 'title', 'url', 'icon', 'order', 'group']
|
||||||
|
|
||||||
|
# сериализатор для групп со вложенными ссылками
|
||||||
|
class LinkGroupSerializer(serializers.ModelSerializer):
|
||||||
|
# related_name у вас в модели LinkGroup.owner = 'api_link_groups',
|
||||||
|
# а у модели Link.group = 'links', так что у группы obj.links — это QuerySet ссылок
|
||||||
|
links = LinkSerializer(many=True, read_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = LinkGroup
|
||||||
|
fields = ['id', 'name', 'order', 'links']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class UserSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
# поля, которые хотите отдавать на фронт:
|
||||||
|
fields = ['id', 'username', 'email', 'full_name']
|
||||||
55
.history/backend/api/serializers_20250506182211.py
Normal file
55
.history/backend/api/serializers_20250506182211.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterSerializer(serializers.ModelSerializer):
|
||||||
|
password = serializers.CharField(write_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
fields = ('username', 'email', 'password')
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
user = User(
|
||||||
|
username=validated_data['username'],
|
||||||
|
email=validated_data.get('email', '')
|
||||||
|
)
|
||||||
|
user.set_password(validated_data['password'])
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.conf import settings
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
# сериализатор для ссылок
|
||||||
|
class LinkSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Link
|
||||||
|
fields = ['id', 'title', 'url', 'icon', 'order', 'group']
|
||||||
|
|
||||||
|
# сериализатор для групп со вложенными ссылками
|
||||||
|
class LinkGroupSerializer(serializers.ModelSerializer):
|
||||||
|
# related_name у вас в модели LinkGroup.owner = 'api_link_groups',
|
||||||
|
# а у модели Link.group = 'links', так что у группы obj.links — это QuerySet ссылок
|
||||||
|
links = LinkSerializer(many=True, read_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = LinkGroup
|
||||||
|
fields = ['id', 'name', 'order', 'links']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class UserSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
# поля, которые хотите отдавать на фронт:
|
||||||
|
fields = ['id', 'username', 'email', 'full_name', 'bio', 'avatar', 'user_permissions']
|
||||||
55
.history/backend/api/serializers_20250506182234.py
Normal file
55
.history/backend/api/serializers_20250506182234.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterSerializer(serializers.ModelSerializer):
|
||||||
|
password = serializers.CharField(write_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
fields = ('username', 'email', 'password')
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
user = User(
|
||||||
|
username=validated_data['username'],
|
||||||
|
email=validated_data.get('email', '')
|
||||||
|
)
|
||||||
|
user.set_password(validated_data['password'])
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.conf import settings
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
# сериализатор для ссылок
|
||||||
|
class LinkSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Link
|
||||||
|
fields = ['id', 'title', 'url', 'icon', 'order', 'group']
|
||||||
|
|
||||||
|
# сериализатор для групп со вложенными ссылками
|
||||||
|
class LinkGroupSerializer(serializers.ModelSerializer):
|
||||||
|
# related_name у вас в модели LinkGroup.owner = 'api_link_groups',
|
||||||
|
# а у модели Link.group = 'links', так что у группы obj.links — это QuerySet ссылок
|
||||||
|
links = LinkSerializer(many=True, read_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = LinkGroup
|
||||||
|
fields = ['id', 'name', 'order', 'links']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class UserSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
# поля, которые хотите отдавать на фронт:
|
||||||
|
fields = ['id', 'username', 'email', 'full_name', 'bio', 'avatar', 'user_permissions', 'last_login', 'date_joined']
|
||||||
55
.history/backend/api/serializers_20250506182243.py
Normal file
55
.history/backend/api/serializers_20250506182243.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterSerializer(serializers.ModelSerializer):
|
||||||
|
password = serializers.CharField(write_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
fields = ('username', 'email', 'password')
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
user = User(
|
||||||
|
username=validated_data['username'],
|
||||||
|
email=validated_data.get('email', '')
|
||||||
|
)
|
||||||
|
user.set_password(validated_data['password'])
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
# api/serializers.py
|
||||||
|
from rest_framework import serializers
|
||||||
|
from django.conf import settings
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
# сериализатор для ссылок
|
||||||
|
class LinkSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Link
|
||||||
|
fields = ['id', 'title', 'url', 'icon', 'order', 'group']
|
||||||
|
|
||||||
|
# сериализатор для групп со вложенными ссылками
|
||||||
|
class LinkGroupSerializer(serializers.ModelSerializer):
|
||||||
|
# related_name у вас в модели LinkGroup.owner = 'api_link_groups',
|
||||||
|
# а у модели Link.group = 'links', так что у группы obj.links — это QuerySet ссылок
|
||||||
|
links = LinkSerializer(many=True, read_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = LinkGroup
|
||||||
|
fields = ['id', 'name', 'order', 'links']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class UserSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = User
|
||||||
|
# поля, которые хотите отдавать на фронт:
|
||||||
|
fields = ['id', 'username', 'email', 'full_name', 'bio', 'avatar', 'last_login', 'date_joined']
|
||||||
0
.history/backend/api/urls_20250506131430.py
Normal file
0
.history/backend/api/urls_20250506131430.py
Normal file
18
.history/backend/api/urls_20250506131439.py
Normal file
18
.history/backend/api/urls_20250506131439.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# api/urls.py
|
||||||
|
from django.urls import path, include
|
||||||
|
from rest_framework.routers import DefaultRouter
|
||||||
|
from .views import (
|
||||||
|
RegisterView, LoginView, LinkViewSet,
|
||||||
|
LinkGroupViewSet, UserLinksListView
|
||||||
|
)
|
||||||
|
|
||||||
|
router = DefaultRouter()
|
||||||
|
router.register(r'links', LinkViewSet, basename='links')
|
||||||
|
router.register(r'groups', LinkGroupViewSet, basename='groups')
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('auth/register/', RegisterView.as_view(), name='auth-register'),
|
||||||
|
path('auth/login/', LoginView.as_view(), name='auth-login'),
|
||||||
|
path('users/<str:username>/links/', UserLinksListView.as_view(), name='user-links'),
|
||||||
|
path('', include(router.urls)),
|
||||||
|
]
|
||||||
15
.history/backend/api/urls_20250506161007.py
Normal file
15
.history/backend/api/urls_20250506161007.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# api/urls.py
|
||||||
|
from django.urls import path, include
|
||||||
|
from rest_framework.routers import DefaultRouter
|
||||||
|
from .views import RegisterView, LoginView, LinkViewSet, LinkGroupViewSet, UserLinksListView
|
||||||
|
|
||||||
|
router = DefaultRouter()
|
||||||
|
router.register(r'links', LinkViewSet, basename='links')
|
||||||
|
router.register(r'groups', LinkGroupViewSet, basename='groups')
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('auth/register/', RegisterView.as_view(), name='auth-register'),
|
||||||
|
path('auth/login/', LoginView.as_view(), name='auth-login'),
|
||||||
|
path('users/<str:username>/links/', UserLinksListView.as_view(), name='user-links'),
|
||||||
|
path('', include(router.urls)),
|
||||||
|
]
|
||||||
22
.history/backend/api/urls_20250506170839.py
Normal file
22
.history/backend/api/urls_20250506170839.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
|
||||||
|
from .views import (
|
||||||
|
RegisterView,
|
||||||
|
UserProfileView,
|
||||||
|
UserLinksView,
|
||||||
|
LinkViewSet,
|
||||||
|
LinkGroupViewSet
|
||||||
|
)
|
||||||
|
from rest_framework.routers import DefaultRouter
|
||||||
|
|
||||||
|
router = DefaultRouter()
|
||||||
|
router.register('links', LinkViewSet, basename='link')
|
||||||
|
router.register('groups', LinkGroupViewSet, basename='group')
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('auth/register/', RegisterView.as_view(), name='auth_register'),
|
||||||
|
path('auth/login/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||||
|
path('auth/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
||||||
|
path('auth/user/', UserProfileView.as_view(), name='user-profile'), # ← новый
|
||||||
|
path('users/<str:username>/links/', UserLinksView.as_view(), name='user-links'),
|
||||||
|
] + router.urls
|
||||||
21
.history/backend/api/urls_20250506170901.py
Normal file
21
.history/backend/api/urls_20250506170901.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
|
||||||
|
from .views import (
|
||||||
|
RegisterView,
|
||||||
|
UserProfileView,
|
||||||
|
LinkViewSet,
|
||||||
|
LinkGroupViewSet
|
||||||
|
)
|
||||||
|
from rest_framework.routers import DefaultRouter
|
||||||
|
|
||||||
|
router = DefaultRouter()
|
||||||
|
router.register('links', LinkViewSet, basename='link')
|
||||||
|
router.register('groups', LinkGroupViewSet, basename='group')
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('auth/register/', RegisterView.as_view(), name='auth_register'),
|
||||||
|
path('auth/login/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||||
|
path('auth/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
||||||
|
path('auth/user/', UserProfileView.as_view(), name='user-profile'), # ← новый
|
||||||
|
path('users/<str:username>/links/', UserLinksView.as_view(), name='user-links'),
|
||||||
|
] + router.urls
|
||||||
20
.history/backend/api/urls_20250506170908.py
Normal file
20
.history/backend/api/urls_20250506170908.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
|
||||||
|
from .views import (
|
||||||
|
RegisterView,
|
||||||
|
UserProfileView,
|
||||||
|
LinkViewSet,
|
||||||
|
LinkGroupViewSet
|
||||||
|
)
|
||||||
|
from rest_framework.routers import DefaultRouter
|
||||||
|
|
||||||
|
router = DefaultRouter()
|
||||||
|
router.register('links', LinkViewSet, basename='link')
|
||||||
|
router.register('groups', LinkGroupViewSet, basename='group')
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('auth/register/', RegisterView.as_view(), name='auth_register'),
|
||||||
|
path('auth/login/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||||
|
path('auth/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
||||||
|
path('auth/user/', UserProfileView.as_view(), name='user-profile'), # ← новый
|
||||||
|
] + router.urls
|
||||||
3
.history/backend/api/views_20250506130805.py
Normal file
3
.history/backend/api/views_20250506130805.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
62
.history/backend/api/views_20250506130955.py
Normal file
62
.history/backend/api/views_20250506130955.py
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
from rest_framework import generics, viewsets, permissions
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from rest_framework_simplejwt.views import TokenObtainPairView
|
||||||
|
from .serializers import (
|
||||||
|
RegisterSerializer, LinkSerializer, LinkGroupSerializer
|
||||||
|
)
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
class RegisterView(generics.CreateAPIView):
|
||||||
|
queryset = User.objects.all()
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
serializer_class = RegisterSerializer
|
||||||
|
|
||||||
|
class LoginView(TokenObtainPairView):
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
class LinkGroupViewSet(viewsets.ModelViewSet):
|
||||||
|
serializer_class = LinkGroupSerializer
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return LinkGroup.objects.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
def perform_create(self, serializer):
|
||||||
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
|
class LinkViewSet(viewsets.ModelViewSet):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return Link.objects.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
def perform_create(self, serializer):
|
||||||
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
|
class UserLinksListView(generics.ListAPIView):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
username = self.kwargs['username']
|
||||||
|
return Link.objects.filter(owner__username=username).order_by('order')
|
||||||
|
|
||||||
|
# api/urls.py
|
||||||
|
from django.urls import path, include
|
||||||
|
from rest_framework.routers import DefaultRouter
|
||||||
|
from .views import (
|
||||||
|
RegisterView, LoginView, LinkViewSet,
|
||||||
|
LinkGroupViewSet, UserLinksListView
|
||||||
|
)
|
||||||
|
|
||||||
|
router = DefaultRouter()
|
||||||
|
router.register(r'links', LinkViewSet, basename='links')
|
||||||
|
router.register(r'groups', LinkGroupViewSet, basename='groups')
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('auth/register/', RegisterView.as_view(), name='auth-register'),
|
||||||
|
path('auth/login/', LoginView.as_view(), name='auth-login'),
|
||||||
|
path('users/<str:username>/links/', UserLinksListView.as_view(), name='user-links'),
|
||||||
|
path('', include(router.urls)),
|
||||||
|
]
|
||||||
44
.history/backend/api/views_20250506160957.py
Normal file
44
.history/backend/api/views_20250506160957.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# api/views.py
|
||||||
|
from rest_framework import generics, viewsets, permissions
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework_simplejwt.views import TokenObtainPairView
|
||||||
|
from .serializers import RegisterSerializer, LinkSerializer, LinkGroupSerializer
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterView(generics.CreateAPIView):
|
||||||
|
queryset = User.objects.all()
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
serializer_class = RegisterSerializer
|
||||||
|
|
||||||
|
class LoginView(TokenObtainPairView):
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
class LinkGroupViewSet(viewsets.ModelViewSet):
|
||||||
|
serializer_class = LinkGroupSerializer
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return LinkGroup.objects.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
def perform_create(self, serializer):
|
||||||
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
|
class LinkViewSet(viewsets.ModelViewSet):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return Link.objects.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
def perform_create(self, serializer):
|
||||||
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
|
class UserLinksListView(generics.ListAPIView):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
username = self.kwargs['username']
|
||||||
|
return Link.objects.filter(owner__username=username).order_by('order')
|
||||||
59
.history/backend/api/views_20250506170809.py
Normal file
59
.history/backend/api/views_20250506170809.py
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# api/views.py
|
||||||
|
from rest_framework import generics, viewsets, permissions
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework_simplejwt.views import TokenObtainPairView
|
||||||
|
from .serializers import RegisterSerializer, LinkSerializer, LinkGroupSerializer
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterView(generics.CreateAPIView):
|
||||||
|
queryset = User.objects.all()
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
serializer_class = RegisterSerializer
|
||||||
|
|
||||||
|
class LoginView(TokenObtainPairView):
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
class LinkGroupViewSet(viewsets.ModelViewSet):
|
||||||
|
serializer_class = LinkGroupSerializer
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return LinkGroup.objects.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
def perform_create(self, serializer):
|
||||||
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
|
class LinkViewSet(viewsets.ModelViewSet):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return Link.objects.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
def perform_create(self, serializer):
|
||||||
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
|
class UserLinksListView(generics.ListAPIView):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
username = self.kwargs['username']
|
||||||
|
return Link.objects.filter(owner__username=username).order_by('order')
|
||||||
|
|
||||||
|
from .serializers import UserSerializer # нужно завести сериализатор для пользователя
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class UserProfileView(generics.RetrieveAPIView):
|
||||||
|
"""
|
||||||
|
Возвращает данные авторизованного пользователя.
|
||||||
|
GET /api/auth/user/
|
||||||
|
"""
|
||||||
|
serializer_class = UserSerializer
|
||||||
|
permission_classes = [permissions.IsAuthenticated]
|
||||||
|
|
||||||
|
def get_object(self):
|
||||||
|
return self.request.user
|
||||||
60
.history/backend/api/views_20250506170815.py
Normal file
60
.history/backend/api/views_20250506170815.py
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# api/views.py
|
||||||
|
from rest_framework import generics, viewsets, permissions
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework_simplejwt.views import TokenObtainPairView
|
||||||
|
from .serializers import RegisterSerializer, LinkSerializer, LinkGroupSerializer
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterView(generics.CreateAPIView):
|
||||||
|
queryset = User.objects.all()
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
serializer_class = RegisterSerializer
|
||||||
|
|
||||||
|
class LoginView(TokenObtainPairView):
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
class LinkGroupViewSet(viewsets.ModelViewSet):
|
||||||
|
serializer_class = LinkGroupSerializer
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return LinkGroup.objects.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
def perform_create(self, serializer):
|
||||||
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
|
class LinkViewSet(viewsets.ModelViewSet):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return Link.objects.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
def perform_create(self, serializer):
|
||||||
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
|
class UserLinksListView(generics.ListAPIView):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
username = self.kwargs['username']
|
||||||
|
return Link.objects.filter(owner__username=username).order_by('order')
|
||||||
|
|
||||||
|
|
||||||
|
from .serializers import UserSerializer # нужно завести сериализатор для пользователя
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class UserProfileView(generics.RetrieveAPIView):
|
||||||
|
"""
|
||||||
|
Возвращает данные авторизованного пользователя.
|
||||||
|
GET /api/auth/user/
|
||||||
|
"""
|
||||||
|
serializer_class = UserSerializer
|
||||||
|
permission_classes = [permissions.IsAuthenticated]
|
||||||
|
|
||||||
|
def get_object(self):
|
||||||
|
return self.request.user
|
||||||
59
.history/backend/api/views_20250506171322.py
Normal file
59
.history/backend/api/views_20250506171322.py
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# api/views.py
|
||||||
|
from rest_framework import generics, viewsets, permissions
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from rest_framework_simplejwt.views import TokenObtainPairView
|
||||||
|
from .serializers import RegisterSerializer, LinkSerializer, LinkGroupSerializer
|
||||||
|
from .models import Link, LinkGroup
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class RegisterView(generics.CreateAPIView):
|
||||||
|
queryset = User.objects.all()
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
serializer_class = RegisterSerializer
|
||||||
|
|
||||||
|
class LoginView(TokenObtainPairView):
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
class LinkGroupViewSet(viewsets.ModelViewSet):
|
||||||
|
queryset = LinkGroup.objects.all()
|
||||||
|
serializer_class = LinkGroupSerializer
|
||||||
|
permission_classes = [permissions.IsAuthenticated]
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
# возвращаем только группы текущего пользователя
|
||||||
|
return self.queryset.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
class LinkViewSet(viewsets.ModelViewSet):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.IsAuthenticated,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return Link.objects.filter(owner=self.request.user).order_by('order')
|
||||||
|
|
||||||
|
def perform_create(self, serializer):
|
||||||
|
serializer.save(owner=self.request.user)
|
||||||
|
|
||||||
|
class UserLinksListView(generics.ListAPIView):
|
||||||
|
serializer_class = LinkSerializer
|
||||||
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
username = self.kwargs['username']
|
||||||
|
return Link.objects.filter(owner__username=username).order_by('order')
|
||||||
|
|
||||||
|
|
||||||
|
from .serializers import UserSerializer # нужно завести сериализатор для пользователя
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
class UserProfileView(generics.RetrieveAPIView):
|
||||||
|
"""
|
||||||
|
Возвращает данные авторизованного пользователя.
|
||||||
|
GET /api/auth/user/
|
||||||
|
"""
|
||||||
|
serializer_class = UserSerializer
|
||||||
|
permission_classes = [permissions.IsAuthenticated]
|
||||||
|
|
||||||
|
def get_object(self):
|
||||||
|
return self.request.user
|
||||||
122
.history/backend/backend/settings_20250506100311.py
Normal file
122
.history/backend/backend/settings_20250506100311.py
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0='
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
125
.history/backend/backend/settings_20250506100423.py
Normal file
125
.history/backend/backend/settings_20250506100423.py
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'django-insecure-n^xvyde5bhrcpk))wj!z4+pczy+i&*6d97pe&)8_2_5+q5gl0='
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
129
.history/backend/backend/settings_20250506100501.py
Normal file
129
.history/backend/backend/settings_20250506100501.py
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = ''
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
129
.history/backend/backend/settings_20250506100658.py
Normal file
129
.history/backend/backend/settings_20250506100658.py
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
129
.history/backend/backend/settings_20250506100717.py
Normal file
129
.history/backend/backend/settings_20250506100717.py
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
133
.history/backend/backend/settings_20250506101214.py
Normal file
133
.history/backend/backend/settings_20250506101214.py
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': env('DATABASE_ENGINE'), # e.g. django.db.backends.postgresql
|
||||||
|
'NAME': env('DATABASE_NAME'), # e.g. links
|
||||||
|
'USER': env('DATABASE_USER'), # e.g. admin
|
||||||
|
'PASSWORD': env('DATABASE_PASSWORD'), # e.g. admin
|
||||||
|
'HOST': env('DATABASE_HOST'), # e.g. db
|
||||||
|
'PORT': env('DATABASE_PORT'), # e.g. 5432
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
133
.history/backend/backend/settings_20250506101323.py
Normal file
133
.history/backend/backend/settings_20250506101323.py
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
135
.history/backend/backend/settings_20250506101656.py
Normal file
135
.history/backend/backend/settings_20250506101656.py
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
135
.history/backend/backend/settings_20250506103339.py
Normal file
135
.history/backend/backend/settings_20250506103339.py
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
135
.history/backend/backend/settings_20250506103521.py
Normal file
135
.history/backend/backend/settings_20250506103521.py
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = [f'{os.getenv('DJANGO_ALLOWED_HOSTS')}',]
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
135
.history/backend/backend/settings_20250506103546.py
Normal file
135
.history/backend/backend/settings_20250506103546.py
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
135
.history/backend/backend/settings_20250506103557.py
Normal file
135
.history/backend/backend/settings_20250506103557.py
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '0.0.0.0').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
135
.history/backend/backend/settings_20250506103609.py
Normal file
135
.history/backend/backend/settings_20250506103609.py
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
137
.history/backend/backend/settings_20250506130832.py
Normal file
137
.history/backend/backend/settings_20250506130832.py
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
152
.history/backend/backend/settings_20250506130857.py
Normal file
152
.history/backend/backend/settings_20250506130857.py
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
153
.history/backend/backend/settings_20250506160856.py
Normal file
153
.history/backend/backend/settings_20250506160856.py
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework_simplejwt',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
153
.history/backend/backend/settings_20250506160905.py
Normal file
153
.history/backend/backend/settings_20250506160905.py
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework_simplejwt',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
154
.history/backend/backend/settings_20250506170034.py
Normal file
154
.history/backend/backend/settings_20250506170034.py
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
"corsheaders",
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework_simplejwt',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
155
.history/backend/backend/settings_20250506170049.py
Normal file
155
.history/backend/backend/settings_20250506170049.py
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
"corsheaders",
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework_simplejwt',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
"corsheaders.middleware.CorsMiddleware",
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
159
.history/backend/backend/settings_20250506170104.py
Normal file
159
.history/backend/backend/settings_20250506170104.py
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
CORS_ALLOWED_ORIGINS = [
|
||||||
|
"http://127.0.0.1:3001",
|
||||||
|
"http://localhost:3001",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
"corsheaders",
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework_simplejwt',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
"corsheaders.middleware.CorsMiddleware",
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
162
.history/backend/backend/settings_20250506185005.py
Normal file
162
.history/backend/backend/settings_20250506185005.py
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
CORS_ALLOWED_ORIGINS = [
|
||||||
|
"http://127.0.0.1:3001",
|
||||||
|
"http://localhost:3001",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
"corsheaders",
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework_simplejwt',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
"corsheaders.middleware.CorsMiddleware",
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
MEDIA_URL = '/storage/'
|
||||||
|
MEDIA_ROOT = BASE_DIR / 'storage'
|
||||||
162
.history/backend/backend/settings_20250506185447.py
Normal file
162
.history/backend/backend/settings_20250506185447.py
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
CORS_ALLOWED_ORIGINS = [
|
||||||
|
"http://127.0.0.1:3001",
|
||||||
|
"http://localhost:3001",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
"corsheaders",
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework_simplejwt',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
"corsheaders.middleware.CorsMiddleware",
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
MEDIA_URL = '/storage/'
|
||||||
|
MEDIA_ROOT = BASE_DIR / 'storage/'
|
||||||
162
.history/backend/backend/settings_20250506190303.py
Normal file
162
.history/backend/backend/settings_20250506190303.py
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
"""
|
||||||
|
Django settings for backend project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
# 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/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY')
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False') == 'True'
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '127.0.0.1').split(',')
|
||||||
|
|
||||||
|
CORS_ALLOWED_ORIGINS = [
|
||||||
|
"http://127.0.0.1:3001",
|
||||||
|
"http://localhost:3001",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
"corsheaders",
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'users',
|
||||||
|
'links',
|
||||||
|
'customization',
|
||||||
|
'api',
|
||||||
|
'rest_framework',
|
||||||
|
'rest_framework_simplejwt',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
"corsheaders.middleware.CorsMiddleware",
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'backend.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'backend.wsgi.application'
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
),
|
||||||
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
|
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
from datetime import timedelta
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'AUTH_HEADER_TYPES': ('Bearer',),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': os.getenv('DATABASE_ENGINE', 'django.db.backends.postgresql'),
|
||||||
|
'NAME': os.getenv('DATABASE_NAME'),
|
||||||
|
'USER': os.getenv('DATABASE_USER'),
|
||||||
|
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
|
||||||
|
'HOST': os.getenv('DATABASE_HOST'),
|
||||||
|
'PORT': os.getenv('DATABASE_PORT'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_USER_MODEL = 'users.User'
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'ru-ru'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
MEDIA_URL = '/storage/'
|
||||||
|
MEDIA_ROOT = BASE_DIR / 'storage'
|
||||||
22
.history/backend/backend/urls_20250506100311.py
Normal file
22
.history/backend/backend/urls_20250506100311.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
"""
|
||||||
|
URL configuration for backend project.
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
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.contrib import admin
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
]
|
||||||
27
.history/backend/backend/urls_20250506131502.py
Normal file
27
.history/backend/backend/urls_20250506131502.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"""
|
||||||
|
URL configuration for backend project.
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
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.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')),
|
||||||
|
path('users/', include('users.urls')),
|
||||||
|
path('links/', include('links.urls')),
|
||||||
|
path('customization/', include('customization.urls')),
|
||||||
|
path('auth/', include('rest_framework.urls', namespace='rest_framework')
|
||||||
|
]
|
||||||
27
.history/backend/backend/urls_20250506131519.py
Normal file
27
.history/backend/backend/urls_20250506131519.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"""
|
||||||
|
URL configuration for backend project.
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
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.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')),
|
||||||
|
path('users/', include('users.urls')),
|
||||||
|
path('links/', include('links.urls')),
|
||||||
|
path('customization/', include('customization.urls')),
|
||||||
|
path('auth/', include('rest_framework.urls', namespace='rest_framework'))
|
||||||
|
]
|
||||||
27
.history/backend/backend/urls_20250506161126.py
Normal file
27
.history/backend/backend/urls_20250506161126.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"""
|
||||||
|
URL configuration for backend project.
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
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.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')),
|
||||||
|
path('users/', include('users.urls')),
|
||||||
|
path('links/', include('links.urls')),
|
||||||
|
path('customization/', include('customization.urls')),
|
||||||
|
path('auth/', include('api.urls', namespace='rest_framework'))
|
||||||
|
]
|
||||||
27
.history/backend/backend/urls_20250506161130.py
Normal file
27
.history/backend/backend/urls_20250506161130.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"""
|
||||||
|
URL configuration for backend project.
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
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.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')),
|
||||||
|
path('users/', include('users.urls')),
|
||||||
|
path('links/', include('links.urls')),
|
||||||
|
path('customization/', include('customization.urls')),
|
||||||
|
path('auth/', include('api.urls', namespace='api'))
|
||||||
|
]
|
||||||
27
.history/backend/backend/urls_20250506161210.py
Normal file
27
.history/backend/backend/urls_20250506161210.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"""
|
||||||
|
URL configuration for backend project.
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
||||||
|
Examples:
|
||||||
|
Function views
|
||||||
|
1. Add an import: from my_app import views
|
||||||
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||||
|
Class-based views
|
||||||
|
1. Add an import: from other_app.views import Home
|
||||||
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||||
|
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.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')),
|
||||||
|
path('users/', include('users.urls')),
|
||||||
|
path('links/', include('links.urls')),
|
||||||
|
path('customization/', include('customization.urls')),
|
||||||
|
path('auth/', include('rest_framework.urls', namespace='rest_framework'))
|
||||||
|
]
|
||||||
11
.history/backend/backend/urls_20250506161305.py
Normal file
11
.history/backend/backend/urls_20250506161305.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')), # API endpoints
|
||||||
|
path('users/', include('users.urls')), # User management app
|
||||||
|
path('links/', include('links.urls')), # Link management app
|
||||||
|
path('customization/', include('customization.urls')), # Design customization app
|
||||||
|
path('auth/', include('rest_framework.urls', namespace='rest_framework')), # DRF login/logout
|
||||||
|
]
|
||||||
54
.history/backend/backend/urls_20250506161315.py
Normal file
54
.history/backend/backend/urls_20250506161315.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')), # API endpoints
|
||||||
|
path('users/', include('users.urls')), # User management app
|
||||||
|
path('links/', include('links.urls')), # Link management app
|
||||||
|
path('customization/', include('customization.urls')), # Design customization app
|
||||||
|
path('auth/', include('rest_framework.urls', namespace='rest_framework')), # DRF login/logout
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Summary of API Endpoints:
|
||||||
|
# POST /api/auth/register/ - Register new user
|
||||||
|
# POST /api/auth/login/ - Obtain JWT tokens (access & refresh)
|
||||||
|
# GET /api/users/<username>/links/ - Public list of user's links
|
||||||
|
# GET /api/links/ - List authenticated user's links
|
||||||
|
# POST /api/links/ - Create a new link
|
||||||
|
# GET /api/links/{id}/ - Retrieve a specific link
|
||||||
|
# PUT /api/links/{id}/ - Update a specific link
|
||||||
|
# PATCH /api/links/{id}/ - Partially update a link
|
||||||
|
# DELETE /api/links/{id}/ - Delete a specific link
|
||||||
|
# GET /api/groups/ - List authenticated user's link groups
|
||||||
|
# POST /api/groups/ - Create a new link group
|
||||||
|
# GET /api/groups/{id}/ - Retrieve a specific link group
|
||||||
|
# PUT /api/groups/{id}/ - Update a link group
|
||||||
|
# PATCH /api/groups/{id}/ - Partially update a link group
|
||||||
|
# DELETE /api/groups/{id}/ - Delete a specific link group
|
||||||
|
|
||||||
|
# To avoid URL configuration errors, ensure the following placeholder URLConfs exist:
|
||||||
|
# users/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define user-management endpoints here (e.g., profile, settings)
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# links/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define additional link-management endpoints here if needed
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# customization/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define design customization endpoints here
|
||||||
|
# ]
|
||||||
54
.history/backend/backend/urls_20250506162508.py
Normal file
54
.history/backend/backend/urls_20250506162508.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')), # API endpoints
|
||||||
|
path('users/', include('users.urls')), # User management app
|
||||||
|
path('links/', include('links.urls')), # Link management app
|
||||||
|
path('customization/', include('customization.urls')), # Design customization app
|
||||||
|
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Summary of API Endpoints:
|
||||||
|
# POST /api/auth/register/ - Register new user
|
||||||
|
# POST /api/auth/login/ - Obtain JWT tokens (access & refresh)
|
||||||
|
# GET /api/users/<username>/links/ - Public list of user's links
|
||||||
|
# GET /api/links/ - List authenticated user's links
|
||||||
|
# POST /api/links/ - Create a new link
|
||||||
|
# GET /api/links/{id}/ - Retrieve a specific link
|
||||||
|
# PUT /api/links/{id}/ - Update a specific link
|
||||||
|
# PATCH /api/links/{id}/ - Partially update a link
|
||||||
|
# DELETE /api/links/{id}/ - Delete a specific link
|
||||||
|
# GET /api/groups/ - List authenticated user's link groups
|
||||||
|
# POST /api/groups/ - Create a new link group
|
||||||
|
# GET /api/groups/{id}/ - Retrieve a specific link group
|
||||||
|
# PUT /api/groups/{id}/ - Update a link group
|
||||||
|
# PATCH /api/groups/{id}/ - Partially update a link group
|
||||||
|
# DELETE /api/groups/{id}/ - Delete a specific link group
|
||||||
|
|
||||||
|
# To avoid URL configuration errors, ensure the following placeholder URLConfs exist:
|
||||||
|
# users/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define user-management endpoints here (e.g., profile, settings)
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# links/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define additional link-management endpoints here if needed
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# customization/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define design customization endpoints here
|
||||||
|
# ]
|
||||||
57
.history/backend/backend/urls_20250506185024.py
Normal file
57
.history/backend/backend/urls_20250506185024.py
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')), # API endpoints
|
||||||
|
path('users/', include('users.urls')), # User management app
|
||||||
|
path('links/', include('links.urls')), # Link management app
|
||||||
|
path('customization/', include('customization.urls')), # Design customization app
|
||||||
|
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||||
|
]
|
||||||
|
|
||||||
|
if settings.DEBUG:
|
||||||
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
||||||
|
|
||||||
|
# Summary of API Endpoints:
|
||||||
|
# POST /api/auth/register/ - Register new user
|
||||||
|
# POST /api/auth/login/ - Obtain JWT tokens (access & refresh)
|
||||||
|
# GET /api/users/<username>/links/ - Public list of user's links
|
||||||
|
# GET /api/links/ - List authenticated user's links
|
||||||
|
# POST /api/links/ - Create a new link
|
||||||
|
# GET /api/links/{id}/ - Retrieve a specific link
|
||||||
|
# PUT /api/links/{id}/ - Update a specific link
|
||||||
|
# PATCH /api/links/{id}/ - Partially update a link
|
||||||
|
# DELETE /api/links/{id}/ - Delete a specific link
|
||||||
|
# GET /api/groups/ - List authenticated user's link groups
|
||||||
|
# POST /api/groups/ - Create a new link group
|
||||||
|
# GET /api/groups/{id}/ - Retrieve a specific link group
|
||||||
|
# PUT /api/groups/{id}/ - Update a link group
|
||||||
|
# PATCH /api/groups/{id}/ - Partially update a link group
|
||||||
|
# DELETE /api/groups/{id}/ - Delete a specific link group
|
||||||
|
|
||||||
|
# To avoid URL configuration errors, ensure the following placeholder URLConfs exist:
|
||||||
|
# users/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define user-management endpoints here (e.g., profile, settings)
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# links/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define additional link-management endpoints here if needed
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# customization/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define design customization endpoints here
|
||||||
|
# ]
|
||||||
58
.history/backend/backend/urls_20250506185029.py
Normal file
58
.history/backend/backend/urls_20250506185029.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')), # API endpoints
|
||||||
|
path('users/', include('users.urls')), # User management app
|
||||||
|
path('links/', include('links.urls')), # Link management app
|
||||||
|
path('customization/', include('customization.urls')), # Design customization app
|
||||||
|
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||||
|
]
|
||||||
|
|
||||||
|
if settings.DEBUG:
|
||||||
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
||||||
|
|
||||||
|
# Summary of API Endpoints:
|
||||||
|
# POST /api/auth/register/ - Register new user
|
||||||
|
# POST /api/auth/login/ - Obtain JWT tokens (access & refresh)
|
||||||
|
# GET /api/users/<username>/links/ - Public list of user's links
|
||||||
|
# GET /api/links/ - List authenticated user's links
|
||||||
|
# POST /api/links/ - Create a new link
|
||||||
|
# GET /api/links/{id}/ - Retrieve a specific link
|
||||||
|
# PUT /api/links/{id}/ - Update a specific link
|
||||||
|
# PATCH /api/links/{id}/ - Partially update a link
|
||||||
|
# DELETE /api/links/{id}/ - Delete a specific link
|
||||||
|
# GET /api/groups/ - List authenticated user's link groups
|
||||||
|
# POST /api/groups/ - Create a new link group
|
||||||
|
# GET /api/groups/{id}/ - Retrieve a specific link group
|
||||||
|
# PUT /api/groups/{id}/ - Update a link group
|
||||||
|
# PATCH /api/groups/{id}/ - Partially update a link group
|
||||||
|
# DELETE /api/groups/{id}/ - Delete a specific link group
|
||||||
|
|
||||||
|
# To avoid URL configuration errors, ensure the following placeholder URLConfs exist:
|
||||||
|
# users/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define user-management endpoints here (e.g., profile, settings)
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# links/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define additional link-management endpoints here if needed
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# customization/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define design customization endpoints here
|
||||||
|
# ]
|
||||||
59
.history/backend/backend/urls_20250506185034.py
Normal file
59
.history/backend/backend/urls_20250506185034.py
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
from django.conf import settings
|
||||||
|
from django.conf.urls.static import static
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')), # API endpoints
|
||||||
|
path('users/', include('users.urls')), # User management app
|
||||||
|
path('links/', include('links.urls')), # Link management app
|
||||||
|
path('customization/', include('customization.urls')), # Design customization app
|
||||||
|
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||||
|
]
|
||||||
|
|
||||||
|
if settings.DEBUG:
|
||||||
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
||||||
|
|
||||||
|
# Summary of API Endpoints:
|
||||||
|
# POST /api/auth/register/ - Register new user
|
||||||
|
# POST /api/auth/login/ - Obtain JWT tokens (access & refresh)
|
||||||
|
# GET /api/users/<username>/links/ - Public list of user's links
|
||||||
|
# GET /api/links/ - List authenticated user's links
|
||||||
|
# POST /api/links/ - Create a new link
|
||||||
|
# GET /api/links/{id}/ - Retrieve a specific link
|
||||||
|
# PUT /api/links/{id}/ - Update a specific link
|
||||||
|
# PATCH /api/links/{id}/ - Partially update a link
|
||||||
|
# DELETE /api/links/{id}/ - Delete a specific link
|
||||||
|
# GET /api/groups/ - List authenticated user's link groups
|
||||||
|
# POST /api/groups/ - Create a new link group
|
||||||
|
# GET /api/groups/{id}/ - Retrieve a specific link group
|
||||||
|
# PUT /api/groups/{id}/ - Update a link group
|
||||||
|
# PATCH /api/groups/{id}/ - Partially update a link group
|
||||||
|
# DELETE /api/groups/{id}/ - Delete a specific link group
|
||||||
|
|
||||||
|
# To avoid URL configuration errors, ensure the following placeholder URLConfs exist:
|
||||||
|
# users/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define user-management endpoints here (e.g., profile, settings)
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# links/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define additional link-management endpoints here if needed
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# customization/urls.py
|
||||||
|
# ----------------
|
||||||
|
# from django.urls import path, include
|
||||||
|
#
|
||||||
|
# urlpatterns = [
|
||||||
|
# # Define design customization endpoints here
|
||||||
|
# ]
|
||||||
3
.history/backend/customization/admin_20250506100403.py
Normal file
3
.history/backend/customization/admin_20250506100403.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
11
.history/backend/customization/admin_20250506103854.py
Normal file
11
.history/backend/customization/admin_20250506103854.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# backend/apps/customization/admin.py
|
||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
from .models import DesignSettings
|
||||||
|
|
||||||
|
@admin.register(DesignSettings)
|
||||||
|
class DesignSettingsAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('user', 'theme_color', 'font_family', 'updated_at')
|
||||||
|
list_filter = ('theme_color',)
|
||||||
|
search_fields = ('user__username',)
|
||||||
|
readonly_fields = ('updated_at',)
|
||||||
3
.history/backend/customization/models_20250506100403.py
Normal file
3
.history/backend/customization/models_20250506100403.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
17
.history/backend/customization/models_20250506101457.py
Normal file
17
.history/backend/customization/models_20250506101457.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
class DesignSettings(models.Model):
|
||||||
|
user = models.OneToOneField(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='design'
|
||||||
|
)
|
||||||
|
theme_color = models.CharField(max_length=7, default='#ffffff')
|
||||||
|
background_image = models.ImageField(upload_to='backgrounds/', null=True, blank=True)
|
||||||
|
font_family = models.CharField(max_length=100, default='sans-serif')
|
||||||
|
custom_css = models.TextField(blank=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"Design for {self.user.username}"
|
||||||
156
.history/backend/customization/models_20250506102230.py
Normal file
156
.history/backend/customization/models_20250506102230.py
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
# customization/models.py
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
class DesignSettings(models.Model):
|
||||||
|
"""
|
||||||
|
Настройки дизайна для публичной страницы пользователя.
|
||||||
|
"""
|
||||||
|
user = models.OneToOneField(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='design',
|
||||||
|
help_text='Пользователь, которому принадлежат настройки'
|
||||||
|
)
|
||||||
|
theme_color = models.CharField(
|
||||||
|
max_length=7,
|
||||||
|
default='#ffffff',
|
||||||
|
help_text='Основной цвет темы (hex)'
|
||||||
|
)
|
||||||
|
background_image = models.ImageField(
|
||||||
|
upload_to='backgrounds/',
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
help_text='Фоновое изображение'
|
||||||
|
)
|
||||||
|
font_family = models.CharField(
|
||||||
|
max_length=100,
|
||||||
|
default='sans-serif',
|
||||||
|
help_text='Название шрифта'
|
||||||
|
)
|
||||||
|
custom_css = models.TextField(
|
||||||
|
blank=True,
|
||||||
|
help_text='Дополнительный CSS'
|
||||||
|
)
|
||||||
|
updated_at = models.DateTimeField(
|
||||||
|
auto_now=True,
|
||||||
|
help_text='Дата и время последнего изменения'
|
||||||
|
)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"Design for {self.user.username}"
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = 'Настройки дизайна'
|
||||||
|
verbose_name_plural = 'Настройки дизайна'
|
||||||
|
ordering = ['user']
|
||||||
|
unique_together = ('user',)
|
||||||
|
def get_background_image_url(self):
|
||||||
|
"""
|
||||||
|
Возвращает URL фонового изображения.
|
||||||
|
"""
|
||||||
|
return self.background_image.url if self.background_image else None
|
||||||
|
def get_custom_css(self):
|
||||||
|
"""
|
||||||
|
Возвращает пользовательский CSS.
|
||||||
|
"""
|
||||||
|
return self.custom_css if self.custom_css else ""
|
||||||
|
def get_design_settings(self):
|
||||||
|
"""
|
||||||
|
Возвращает словарь с настройками дизайна.
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
'theme_color': self.theme_color,
|
||||||
|
'background_image': self.get_background_image_url(),
|
||||||
|
'font_family': self.font_family,
|
||||||
|
'custom_css': self.get_custom_css()
|
||||||
|
}
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Переопределяем метод save, чтобы автоматически обновлять дату изменения.
|
||||||
|
"""
|
||||||
|
self.updated_at = timezone.now()
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
def delete(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Переопределяем метод delete, чтобы удалять связанные изображения.
|
||||||
|
"""
|
||||||
|
if self.background_image:
|
||||||
|
self.background_image.delete(save=False)
|
||||||
|
super().delete(*args, **kwargs)
|
||||||
|
def get_user(self):
|
||||||
|
"""
|
||||||
|
Возвращает пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user
|
||||||
|
def get_user_id(self):
|
||||||
|
"""
|
||||||
|
Возвращает ID пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.id
|
||||||
|
def get_user_username(self):
|
||||||
|
"""
|
||||||
|
Возвращает имя пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.username
|
||||||
|
def get_user_email(self):
|
||||||
|
"""
|
||||||
|
Возвращает email пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.email if self.user.email else "Нет email"
|
||||||
|
def get_user_full_name(self):
|
||||||
|
"""
|
||||||
|
Возвращает полное имя пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_full_name() if self.user.get_full_name() else "Нет полного имени"
|
||||||
|
def get_user_bio(self):
|
||||||
|
"""
|
||||||
|
Возвращает биографию пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_bio() if self.user.get_bio() else "Нет биографии"
|
||||||
|
def get_user_avatar(self):
|
||||||
|
"""
|
||||||
|
Возвращает URL аватара пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_avatar() if self.user.get_avatar() else None
|
||||||
|
def get_user_links(self):
|
||||||
|
"""
|
||||||
|
Возвращает список ссылок пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_user_links() if self.user.get_user_links() else []
|
||||||
|
def get_user_groups(self):
|
||||||
|
"""
|
||||||
|
Возвращает группы пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_user_groups() if self.user.get_user_groups() else []
|
||||||
|
def get_user_design(self):
|
||||||
|
"""
|
||||||
|
Возвращает настройки дизайна пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_user_design() if self.user.get_user_design() else None
|
||||||
|
def get_user_info(self):
|
||||||
|
"""
|
||||||
|
Возвращает информацию о пользователе, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_user_info() if self.user.get_user_info() else {}
|
||||||
|
def get_user_settings(self):
|
||||||
|
"""
|
||||||
|
Возвращает настройки пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_user_settings() if self.user.get_user_settings() else {}
|
||||||
|
def get_user_preferences(self):
|
||||||
|
"""
|
||||||
|
Возвращает предпочтения пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_user_preferences() if self.user.get_user_preferences() else {}
|
||||||
|
def get_user_notifications(self):
|
||||||
|
"""
|
||||||
|
Возвращает уведомления пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_user_notifications() if self.user.get_user_notifications() else []
|
||||||
|
def get_user_friends(self):
|
||||||
|
"""
|
||||||
|
Возвращает друзей пользователя, которому принадлежат настройки дизайна.
|
||||||
|
"""
|
||||||
|
return self.user.get_user_friends() if self.user.get_user_friends() else []
|
||||||
110
.history/backend/customization/models_20250506102358.py
Normal file
110
.history/backend/customization/models_20250506102358.py
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
# customization/models.py
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
class DesignSettings(models.Model):
|
||||||
|
"""
|
||||||
|
Настройки дизайна для публичной страницы пользователя.
|
||||||
|
"""
|
||||||
|
user = models.OneToOneField(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='design',
|
||||||
|
help_text='Пользователь, которому принадлежат настройки'
|
||||||
|
)
|
||||||
|
theme_color = models.CharField(
|
||||||
|
max_length=7,
|
||||||
|
default='#ffffff',
|
||||||
|
help_text='Основной цвет темы (hex)'
|
||||||
|
)
|
||||||
|
background_image = models.ImageField(
|
||||||
|
upload_to='backgrounds/',
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
help_text='Фоновое изображение'
|
||||||
|
)
|
||||||
|
font_family = models.CharField(
|
||||||
|
max_length=100,
|
||||||
|
default='sans-serif',
|
||||||
|
help_text='Название шрифта'
|
||||||
|
)
|
||||||
|
custom_css = models.TextField(
|
||||||
|
blank=True,
|
||||||
|
help_text='Дополнительный CSS'
|
||||||
|
)
|
||||||
|
updated_at = models.DateTimeField(
|
||||||
|
auto_now=True,
|
||||||
|
help_text='Дата и время последнего изменения'
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = 'Настройки дизайна'
|
||||||
|
verbose_name_plural = 'Настройки дизайна'
|
||||||
|
ordering = ['user']
|
||||||
|
unique_together = ('user',)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"Design for {self.user.username}"
|
||||||
|
|
||||||
|
def get_background_image_url(self):
|
||||||
|
"""
|
||||||
|
Возвращает URL фонового изображения.
|
||||||
|
"""
|
||||||
|
return self.background_image.url if self.background_image else None
|
||||||
|
|
||||||
|
def get_custom_css(self):
|
||||||
|
"""
|
||||||
|
Возвращает пользовательский CSS.
|
||||||
|
"""
|
||||||
|
return self.custom_css or ""
|
||||||
|
|
||||||
|
def get_design_settings(self):
|
||||||
|
"""
|
||||||
|
Возвращает словарь с настройками дизайна.
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
'theme_color': self.theme_color,
|
||||||
|
'background_image': self.get_background_image_url(),
|
||||||
|
'font_family': self.font_family,
|
||||||
|
'custom_css': self.get_custom_css()
|
||||||
|
}
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Переопределяем метод save, чтобы автоматически обновлять дату изменения.
|
||||||
|
"""
|
||||||
|
self.updated_at = timezone.now()
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
def delete(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Переопределяем метод delete, чтобы удалять связанные изображения.
|
||||||
|
"""
|
||||||
|
if self.background_image:
|
||||||
|
self.background_image.delete(save=False)
|
||||||
|
super().delete(*args, **kwargs)
|
||||||
|
|
||||||
|
# Вспомогательные методы для доступа к данным пользователя
|
||||||
|
|
||||||
|
def get_user(self):
|
||||||
|
return self.user
|
||||||
|
|
||||||
|
def get_user_id(self):
|
||||||
|
return self.user.id
|
||||||
|
|
||||||
|
def get_user_username(self):
|
||||||
|
return self.user.username
|
||||||
|
|
||||||
|
def get_user_email(self):
|
||||||
|
return self.user.email or "Нет email"
|
||||||
|
|
||||||
|
def get_user_full_name(self):
|
||||||
|
return self.user.get_full_name() or "Нет полного имени"
|
||||||
|
|
||||||
|
def get_user_bio(self):
|
||||||
|
return self.user.bio or "Нет биографии"
|
||||||
|
|
||||||
|
def get_user_avatar(self):
|
||||||
|
return self.user.avatar.url if self.user.avatar else None
|
||||||
110
.history/backend/customization/models_20250506185325.py
Normal file
110
.history/backend/customization/models_20250506185325.py
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
# customization/models.py
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
class DesignSettings(models.Model):
|
||||||
|
"""
|
||||||
|
Настройки дизайна для публичной страницы пользователя.
|
||||||
|
"""
|
||||||
|
user = models.OneToOneField(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='design',
|
||||||
|
help_text='Пользователь, которому принадлежат настройки'
|
||||||
|
)
|
||||||
|
theme_color = models.CharField(
|
||||||
|
max_length=7,
|
||||||
|
default='#ffffff',
|
||||||
|
help_text='Основной цвет темы (hex)'
|
||||||
|
)
|
||||||
|
background_image = models.ImageField(
|
||||||
|
upload_to='customization/',
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
help_text='Фоновое изображение'
|
||||||
|
)
|
||||||
|
font_family = models.CharField(
|
||||||
|
max_length=100,
|
||||||
|
default='sans-serif',
|
||||||
|
help_text='Название шрифта'
|
||||||
|
)
|
||||||
|
custom_css = models.TextField(
|
||||||
|
blank=True,
|
||||||
|
help_text='Дополнительный CSS'
|
||||||
|
)
|
||||||
|
updated_at = models.DateTimeField(
|
||||||
|
auto_now=True,
|
||||||
|
help_text='Дата и время последнего изменения'
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = 'Настройки дизайна'
|
||||||
|
verbose_name_plural = 'Настройки дизайна'
|
||||||
|
ordering = ['user']
|
||||||
|
unique_together = ('user',)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"Design for {self.user.username}"
|
||||||
|
|
||||||
|
def get_background_image_url(self):
|
||||||
|
"""
|
||||||
|
Возвращает URL фонового изображения.
|
||||||
|
"""
|
||||||
|
return self.background_image.url if self.background_image else None
|
||||||
|
|
||||||
|
def get_custom_css(self):
|
||||||
|
"""
|
||||||
|
Возвращает пользовательский CSS.
|
||||||
|
"""
|
||||||
|
return self.custom_css or ""
|
||||||
|
|
||||||
|
def get_design_settings(self):
|
||||||
|
"""
|
||||||
|
Возвращает словарь с настройками дизайна.
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
'theme_color': self.theme_color,
|
||||||
|
'background_image': self.get_background_image_url(),
|
||||||
|
'font_family': self.font_family,
|
||||||
|
'custom_css': self.get_custom_css()
|
||||||
|
}
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Переопределяем метод save, чтобы автоматически обновлять дату изменения.
|
||||||
|
"""
|
||||||
|
self.updated_at = timezone.now()
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
def delete(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Переопределяем метод delete, чтобы удалять связанные изображения.
|
||||||
|
"""
|
||||||
|
if self.background_image:
|
||||||
|
self.background_image.delete(save=False)
|
||||||
|
super().delete(*args, **kwargs)
|
||||||
|
|
||||||
|
# Вспомогательные методы для доступа к данным пользователя
|
||||||
|
|
||||||
|
def get_user(self):
|
||||||
|
return self.user
|
||||||
|
|
||||||
|
def get_user_id(self):
|
||||||
|
return self.user.id
|
||||||
|
|
||||||
|
def get_user_username(self):
|
||||||
|
return self.user.username
|
||||||
|
|
||||||
|
def get_user_email(self):
|
||||||
|
return self.user.email or "Нет email"
|
||||||
|
|
||||||
|
def get_user_full_name(self):
|
||||||
|
return self.user.get_full_name() or "Нет полного имени"
|
||||||
|
|
||||||
|
def get_user_bio(self):
|
||||||
|
return self.user.bio or "Нет биографии"
|
||||||
|
|
||||||
|
def get_user_avatar(self):
|
||||||
|
return self.user.avatar.url if self.user.avatar else None
|
||||||
5
.history/backend/customization/urls_20250506161339.py
Normal file
5
.history/backend/customization/urls_20250506161339.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
# дополнительные эндпоинты по ссылкам
|
||||||
|
]
|
||||||
3
.history/backend/links/admin_20250506100403.py
Normal file
3
.history/backend/links/admin_20250506100403.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
18
.history/backend/links/admin_20250506103848.py
Normal file
18
.history/backend/links/admin_20250506103848.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# backend/apps/links/admin.py
|
||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
from .models import LinkGroup, Link
|
||||||
|
|
||||||
|
@admin.register(LinkGroup)
|
||||||
|
class LinkGroupAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('title', 'owner', 'order')
|
||||||
|
list_filter = ('owner',)
|
||||||
|
search_fields = ('title', 'owner__username')
|
||||||
|
ordering = ('owner', 'order')
|
||||||
|
|
||||||
|
@admin.register(Link)
|
||||||
|
class LinkAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('title', 'group', 'is_active', 'order', 'created_at')
|
||||||
|
list_filter = ('group', 'is_active')
|
||||||
|
search_fields = ('title', 'url', 'group__title', 'group__owner__username')
|
||||||
|
ordering = ('group', 'order')
|
||||||
3
.history/backend/links/models_20250506100403.py
Normal file
3
.history/backend/links/models_20250506100403.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
37
.history/backend/links/models_20250506101446.py
Normal file
37
.history/backend/links/models_20250506101446.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='groups'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order']
|
||||||
|
unique_together = ('owner', 'title')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} – {self.title}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
is_active = models.BooleanField(default=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order']
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
37
.history/backend/links/models_20250506101720.py
Normal file
37
.history/backend/links/models_20250506101720.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='groups'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order']
|
||||||
|
unique_together = ('owner', 'title')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} – {self.title}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
is_active = models.BooleanField(default=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order']
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
37
.history/backend/links/models_20250506101824.py
Normal file
37
.history/backend/links/models_20250506101824.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
class LinkGroup(models.Model):
|
||||||
|
owner = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='link_groups' # изменено, чтобы не конфликтовать с auth.User.groups
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=100)
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order']
|
||||||
|
unique_together = ('owner', 'title')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.owner.username} – {self.title}"
|
||||||
|
|
||||||
|
class Link(models.Model):
|
||||||
|
group = models.ForeignKey(
|
||||||
|
LinkGroup,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name='links'
|
||||||
|
)
|
||||||
|
title = models.CharField(max_length=200)
|
||||||
|
url = models.URLField()
|
||||||
|
order = models.PositiveIntegerField(default=0)
|
||||||
|
is_active = models.BooleanField(default=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['order']
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user