first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 22:22:29 +03:00
commit ec28a2024d
208 changed files with 23836 additions and 0 deletions

68
.dockerignore Normal file
View File

@@ -0,0 +1,68 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
*.egg-info/
dist/
*.egg
*.pyc
*.pyo
*.pyd
# Virtual Environment
venv/
env/
ENV/
.venv
# Django
*.log
db.sqlite3
db.sqlite3-journal
/staticfiles/
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
# Git
.git/
.gitignore
# Docker
.dockerignore
Dockerfile
docker-compose*.yml
# Documentation
*.md
!README.md
# Test
.coverage
htmlcov/
.pytest_cache/
.tox/
# Environment variables
.env
.env.*
!.env.example
# Secrets
*.pem
*.key
client_secret*.json
# OS
Thumbs.db
# Backup files
*.bak
*~

40
.env Normal file
View File

@@ -0,0 +1,40 @@
# Django Settings
DEBUG=1
SECRET_KEY='django-insecure-slih+3-7gn0b04-2wm4zq)rp*kz1jnt&bf9o3i3*8jhz*n9=2k'
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,api.beyhano.net.tr,api.beyhano.com.tr
# Database Settings (Mevcut PostgreSQL sunucunuz)
USE_POSTGRES=True
POSTGRES_DB=server_dj
POSTGRES_USER=cloud
POSTGRES_PASSWORD=gg7678290
POSTGRES_HOST=10.80.80.70
#POSTGRES_HOST=ares-postgresql-bieeud
POSTGRES_PORT=5432
# Social Auth (Google)
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY='915364976256-691m0s87as2r5vdbqr96f6humblseobt.apps.googleusercontent.com' # Your Google Client ID
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET='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' # Your Google Client Secret
# Social Auth (GitHub)
SOCIAL_AUTH_GITHUB_KEY='Ov23liUt9B61O46Mdfm4' # Your GitHub Client ID
SOCIAL_AUTH_GITHUB_SECRET='c7fc8dcb1b2c8f22120608425d07d5efd995baaf' # Your GitHub Client Secret
# Email Settings (Optional)
EMAIL_HOST=10.80.80.70
EMAIL_PORT=1025
EMAIL_HOST_USER=''
EMAIL_HOST_PASSWORD=''
EMAIL_USE_TLS=False
DEFAULT_FROM_EMAIL='noreply@localhost'
# Additional settings
CSRF_TRUSTED_ORIGINS=https://beyhano.net.tr,https://api.beyhano.net.tr,https://api.beyhano.com.tr
DEBUG=True
REDIS_URL=redis://default:gg7678290@10.80.80.70:6379
DJOSER_DOMAIN=localhost:3000
DJOSER_SITE_NAME=Django Auth API
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:5173,http://127.0.0.1:5173,http://localhost:8080,http://127.0.0.1:8080
EMAIL_USE_SSL=False
SOCIAL_AUTH_FACEBOOK_KEY=
SOCIAL_AUTH_FACEBOOK_SECRET=

39
.env.example Normal file
View File

@@ -0,0 +1,39 @@
# Django Settings
DEBUG=True
SECRET_KEY='your-secret-key-here'
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,yourdomain.com
# Database Settings (Mevcut PostgreSQL sunucunuz)
USE_POSTGRES=True
POSTGRES_DB=server_dj
POSTGRES_USER=cloud
POSTGRES_PASSWORD=your-password
POSTGRES_HOST=10.80.80.70
POSTGRES_PORT=5432
# Social Auth (Google)
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY='your-google-client-id' # Your Google Client ID
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET='your-google-client-secret' # Your Google Client Secret
# Social Auth (GitHub)
SOCIAL_AUTH_GITHUB_KEY='your-github-client-id' # Your GitHub Client ID
SOCIAL_AUTH_GITHUB_SECRET='your-github-client-secret' # Your GitHub Client Secret
# Email Settings (Optional)
EMAIL_HOST=10.80.80.70
EMAIL_PORT=1025
EMAIL_HOST_USER=''
EMAIL_HOST_PASSWORD=''
EMAIL_USE_TLS=False
EMAIL_USE_SSL=False
DEFAULT_FROM_EMAIL='noreply@localhost'
# Additional settings
CSRF_TRUSTED_ORIGINS=https://yourdomain.com,https://api.yourdomain.com
REDIS_URL=redis://default:your-redis-password@10.80.80.70:6379
DJOSER_DOMAIN=localhost:3000
DJOSER_SITE_NAME=Django Auth API
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:5173,http://127.0.0.1:5173,http://localhost:8080,http://127.0.0.1:8080
SOCIAL_AUTH_FACEBOOK_KEY=
SOCIAL_AUTH_FACEBOOK_SECRET=

177
.gitignore vendored Normal file
View File

@@ -0,0 +1,177 @@
### Django template
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
db.sqlite3-journal
media
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly.
# <django-project-name>/staticfiles/
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

12
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,12 @@
# Default ignored files
/shelf/
/workspace.xml
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
# Django PowerTools cache (generated)
/djangoPowerTools/

6
.idea/copilot.data.migration.agent.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

6
.idea/copilot.data.migration.ask.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AskMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Ask2AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

6
.idea/copilot.data.migration.edit.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EditMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

7
.idea/dictionaries/project.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="project">
<words>
<w>beyhano</w>
</words>
</dictionary>
</component>

30
.idea/dj52.iml generated Normal file
View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="FacetManager">
<facet type="django" name="Django">
<configuration>
<option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="core/settings.py" />
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
<option name="environment" value="&lt;map/&gt;" />
<option name="doNotUseTestRunner" value="false" />
<option name="trackFilePattern" value="migrations" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.13 (dj52)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" />
</component>
</module>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SqlNoDataSourceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.14 (dj52)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (dj52)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/dj52.iml" filepath="$PROJECT_DIR$/.idea/dj52.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

904
AUTH.md Normal file
View File

@@ -0,0 +1,904 @@
# Authentication API Documentation
Bu doküman, Django REST API'nin authentication endpoint'lerini ve kullanım örneklerini içerir.
## 📋 İçindekiler
1. [Genel Bilgiler](#genel-bilgiler)
2. [Registration (Kayıt)](#registration-kayıt)
3. [Email Activation (Aktivasyon)](#email-activation-aktivasyon)
4. [Login (Giriş)](#login-giriş)
5. [Token Refresh](#token-refresh)
6. [Social Authentication](#social-authentication)
7. [User Profile](#user-profile)
8. [Password Reset](#password-reset)
9. [Frontend Entegrasyonu](#frontend-entegrasyonu)
10. [Error Handling](#error-handling)
---
## Genel Bilgiler
**Base URL:** `http://localhost:8000/api/v1/`
**Authentication:** JWT Bearer Token
```
Authorization: Bearer <access_token>
```
**Content-Type:** `application/json`
### Rate Limiting
- **Anonymous users:** 100 requests/hour
- **Authenticated users:** 1000 requests/hour
---
## Registration (Kayıt)
### Endpoint
```
POST /api/v1/auth/users/
```
### Request Body
```json
{
"email": "user@example.com",
"password": "StrongP@ssw0rd123",
"re_password": "StrongP@ssw0rd123",
"first_name": "Ali",
"last_name": "Veli"
}
```
### Response (201 Created)
```json
{
"id": 1,
"email": "user@example.com",
"first_name": "Ali",
"last_name": "Veli"
}
```
### Önemli Notlar
- Kullanıcı oluşturulur ancak **`is_active=False`** olarak ayarlanır
- Aktivasyon emaili otomatik gönderilir
- Kullanıcı email aktivasyonu yapmadan login olamaz
- Password minimum 8 karakter olmalı ve güçlü olmalı
### Curl Example
```bash
curl -X POST http://localhost:8000/api/v1/auth/users/ \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "StrongP@ssw0rd123",
"re_password": "StrongP@ssw0rd123",
"first_name": "Ali",
"last_name": "Veli"
}'
```
---
## Email Activation (Aktivasyon)
### Endpoint
```
POST /api/v1/auth/users/activation/
```
### Request Body
```json
{
"uid": "MQ",
"token": "c4h7vu-a8f3d2e1c4b5a6d7e8f9g0h1"
}
```
### Response (204 No Content)
Başarılı aktivasyon sonrası response body boş döner.
### Önemli Notlar
- `uid` ve `token` aktivasyon emailindeki linkten alınır
- Token 24 saat geçerlidir
- Başarılı aktivasyon sonrası `is_active=True` olur
- Kullanıcı artık login olabilir
### Email Link Format
```
http://localhost:3000/auth/activate/{uid}/{token}/
```
Frontend bu linki yakalayıp backend'e POST request yapmalı.
### Curl Example
```bash
curl -X POST http://localhost:8000/api/v1/auth/users/activation/ \
-H "Content-Type: application/json" \
-d '{
"uid": "MQ",
"token": "c4h7vu-a8f3d2e1c4b5a6d7e8f9g0h1"
}'
```
### Resend Activation Email
```
POST /api/v1/auth/users/resend_activation/
```
Request Body:
```json
{
"email": "user@example.com"
}
```
---
## Login (Giriş)
### Endpoint
```
POST /api/v1/auth/jwt/create/
```
### Request Body
```json
{
"email": "user@example.com",
"password": "StrongP@ssw0rd123"
}
```
### Response (200 OK)
```json
{
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
```
### Token Bilgileri
- **Access Token:** 60 dakika geçerli
- **Refresh Token:** 7 gün geçerli
- Token rotation aktif (refresh kullanıldığında yeni refresh token döner)
### Önemli Notlar
- Kullanıcı `is_active=False` ise login başarısız olur
- Hatalı email/password için 401 Unauthorized döner
### Curl Example
```bash
curl -X POST http://localhost:8000/api/v1/auth/jwt/create/ \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "StrongP@ssw0rd123"
}'
```
### Error Response (401 Unauthorized)
```json
{
"detail": "No active account found with the given credentials"
}
```
---
## Token Refresh
### Endpoint
```
POST /api/v1/auth/jwt/refresh/
```
### Request Body
```json
{
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
```
### Response (200 OK)
```json
{
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
```
### Önemli Notlar
- Yeni access token ve yeni refresh token döner (rotation)
- Eski refresh token blacklist'e eklenir
- Refresh token expire olduysa 401 döner
### Curl Example
```bash
curl -X POST http://localhost:8000/api/v1/auth/jwt/refresh/ \
-H "Content-Type: application/json" \
-d '{
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}'
```
---
## Social Authentication
### Supported Providers
- **Google:** `google-oauth2`
- **GitHub:** `github`
- **Facebook:** `facebook`
### Endpoint
```
POST /api/v1/auth/social/<provider>/
```
### Request Body
```json
{
"access_token": "ya29.a0AfH6SMBx..."
}
```
### Response (200 OK)
```json
{
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 1,
"email": "user@example.com",
"first_name": "Ali",
"last_name": "Veli",
"is_active": true,
"date_joined": "2025-12-12T21:30:00Z"
}
}
```
### Önemli Notlar
- Social login ile gelen kullanıcılar **otomatik aktif** (`is_active=True`)
- Email aktivasyon gerekmez
- Kullanıcı yoksa otomatik oluşturulur
- Provider'dan email alınamazsa hata döner
### Google OAuth2 Example
#### 1. Frontend'de Google OAuth
```javascript
// Google OAuth2 ile token al
const googleUser = await gapi.auth2.getAuthInstance().signIn();
const accessToken = googleUser.getAuthResponse().access_token;
// Backend'e gönder
const response = await fetch('http://localhost:8000/api/v1/auth/social/google-oauth2/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
access_token: accessToken
})
});
const data = await response.json();
// data.access, data.refresh, data.user
```
#### 2. Curl Example
```bash
curl -X POST http://localhost:8000/api/v1/auth/social/google-oauth2/ \
-H "Content-Type: application/json" \
-d '{
"access_token": "ya29.a0AfH6SMBx..."
}'
```
### GitHub OAuth2 Example
```bash
curl -X POST http://localhost:8000/api/v1/auth/social/github/ \
-H "Content-Type: application/json" \
-d '{
"access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a"
}'
```
### Error Responses
**Invalid Provider (400)**
```json
{
"error": "Invalid provider. Must be one of: google-oauth2, github, facebook"
}
```
**Missing Token (400)**
```json
{
"error": "access_token is required"
}
```
**Authentication Failed (401)**
```json
{
"error": "Authentication failed. Invalid token."
}
```
**Email Not Provided (403)**
```json
{
"error": "Authentication forbidden. Email not provided by provider or permission denied."
}
```
---
## User Profile
### Get Current User
```
GET /api/v1/auth/users/me/
```
**Headers:**
```
Authorization: Bearer <access_token>
```
**Response (200 OK):**
```json
{
"id": 1,
"email": "user@example.com",
"first_name": "Ali",
"last_name": "Veli",
"is_active": true,
"date_joined": "2025-12-12T21:30:00Z"
}
```
### Update Current User
```
PATCH /api/v1/auth/users/me/
```
**Request Body:**
```json
{
"first_name": "Ahmet",
"last_name": "Yılmaz"
}
```
### Curl Example
```bash
curl -X GET http://localhost:8000/api/v1/auth/users/me/ \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
```
---
## Password Reset
### 1. Request Password Reset
```
POST /api/v1/auth/users/reset_password/
```
**Request Body:**
```json
{
"email": "user@example.com"
}
```
**Response (204 No Content)**
Email gönderilir, link formatı:
```
http://localhost:3000/auth/password/reset/confirm/{uid}/{token}/
```
### 2. Confirm Password Reset
```
POST /api/v1/auth/users/reset_password_confirm/
```
**Request Body:**
```json
{
"uid": "MQ",
"token": "c4h7vu-a8f3d2e1c4b5a6d7e8f9g0h1",
"new_password": "NewStrongP@ssw0rd123",
"re_new_password": "NewStrongP@ssw0rd123"
}
```
**Response (204 No Content)**
---
## Frontend Entegrasyonu
### Nuxt.js 3 Example
#### 1. Composable: `useAuth.ts`
```typescript
// composables/useAuth.ts
export const useAuth = () => {
const config = useRuntimeConfig();
const accessToken = useCookie('access_token');
const refreshToken = useCookie('refresh_token');
const register = async (userData: {
email: string;
password: string;
re_password: string;
first_name: string;
last_name: string;
}) => {
const { data, error } = await useFetch(`${config.public.apiBase}/auth/users/`, {
method: 'POST',
body: userData,
});
return { data, error };
};
const login = async (email: string, password: string) => {
const { data, error } = await useFetch(`${config.public.apiBase}/auth/jwt/create/`, {
method: 'POST',
body: { email, password },
});
if (data.value) {
accessToken.value = data.value.access;
refreshToken.value = data.value.refresh;
}
return { data, error };
};
const socialLogin = async (provider: string, accessTokenValue: string) => {
const { data, error } = await useFetch(
`${config.public.apiBase}/auth/social/${provider}/`,
{
method: 'POST',
body: { access_token: accessTokenValue },
}
);
if (data.value) {
accessToken.value = data.value.access;
refreshToken.value = data.value.refresh;
}
return { data, error };
};
const getUser = async () => {
if (!accessToken.value) return null;
const { data } = await useFetch(`${config.public.apiBase}/auth/users/me/`, {
headers: {
Authorization: `Bearer ${accessToken.value}`,
},
});
return data.value;
};
const logout = () => {
accessToken.value = null;
refreshToken.value = null;
};
return {
register,
login,
socialLogin,
getUser,
logout,
accessToken,
refreshToken,
};
};
```
#### 2. Register Page: `pages/auth/register.vue`
```vue
<template>
<div>
<h1>Register</h1>
<form @submit.prevent="handleRegister">
<input v-model="form.email" type="email" placeholder="Email" required />
<input v-model="form.first_name" placeholder="First Name" />
<input v-model="form.last_name" placeholder="Last Name" />
<input v-model="form.password" type="password" placeholder="Password" required />
<input v-model="form.re_password" type="password" placeholder="Confirm Password" required />
<button type="submit">Register</button>
</form>
<p v-if="message">{{ message }}</p>
</div>
</template>
<script setup lang="ts">
const { register } = useAuth();
const form = ref({
email: '',
password: '',
re_password: '',
first_name: '',
last_name: '',
});
const message = ref('');
const handleRegister = async () => {
const { data, error } = await register(form.value);
if (error.value) {
message.value = 'Registration failed';
} else {
message.value = 'Registration successful! Please check your email to activate your account.';
}
};
</script>
```
#### 3. Activation Page: `pages/auth/activate/[uid]/[token].vue`
```vue
<template>
<div>
<h1>Account Activation</h1>
<p v-if="loading">Activating your account...</p>
<p v-else-if="success"> Account activated successfully! You can now login.</p>
<p v-else-if="error"> Activation failed. Link may be expired.</p>
</div>
</template>
<script setup lang="ts">
const route = useRoute();
const config = useRuntimeConfig();
const loading = ref(true);
const success = ref(false);
const error = ref(false);
onMounted(async () => {
const { uid, token } = route.params;
try {
await $fetch(`${config.public.apiBase}/auth/users/activation/`, {
method: 'POST',
body: { uid, token },
});
success.value = true;
} catch (e) {
error.value = true;
} finally {
loading.value = false;
}
});
</script>
```
#### 4. Login Page: `pages/auth/login.vue`
```vue
<template>
<div>
<h1>Login</h1>
<form @submit.prevent="handleLogin">
<input v-model="email" type="email" placeholder="Email" required />
<input v-model="password" type="password" placeholder="Password" required />
<button type="submit">Login</button>
</form>
<div class="social-login">
<button @click="handleGoogleLogin">Login with Google</button>
<button @click="handleGithubLogin">Login with GitHub</button>
</div>
<p v-if="error">{{ error }}</p>
</div>
</template>
<script setup lang="ts">
const { login, socialLogin } = useAuth();
const router = useRouter();
const email = ref('');
const password = ref('');
const error = ref('');
const handleLogin = async () => {
const { data, error: loginError } = await login(email.value, password.value);
if (loginError.value) {
error.value = 'Login failed. Please check your credentials.';
} else {
router.push('/dashboard');
}
};
const handleGoogleLogin = async () => {
// Google OAuth2 implementation
// Use @nuxtjs/google-oauth2 or similar
const googleToken = await getGoogleAccessToken(); // Your implementation
const { data, error: socialError } = await socialLogin('google-oauth2', googleToken);
if (!socialError.value) {
router.push('/dashboard');
}
};
const handleGithubLogin = async () => {
// GitHub OAuth2 implementation
const githubToken = await getGithubAccessToken(); // Your implementation
const { data, error: socialError } = await socialLogin('github', githubToken);
if (!socialError.value) {
router.push('/dashboard');
}
};
</script>
```
### Next.js 14 Example
#### 1. Auth Context: `context/AuthContext.tsx`
```typescript
'use client';
import { createContext, useContext, useState, useEffect } from 'react';
interface User {
id: number;
email: string;
first_name: string;
last_name: string;
}
interface AuthContextType {
user: User | null;
login: (email: string, password: string) => Promise<void>;
logout: () => void;
register: (userData: any) => Promise<void>;
}
const AuthContext = createContext<AuthContextType | undefined>(undefined);
export function AuthProvider({ children }: { children: React.ReactNode }) {
const [user, setUser] = useState<User | null>(null);
const [accessToken, setAccessToken] = useState<string | null>(null);
useEffect(() => {
// Load token from localStorage
const token = localStorage.getItem('access_token');
if (token) {
setAccessToken(token);
fetchUser(token);
}
}, []);
const fetchUser = async (token: string) => {
try {
const response = await fetch('http://localhost:8000/api/v1/auth/users/me/', {
headers: {
'Authorization': `Bearer ${token}`,
},
});
const data = await response.json();
setUser(data);
} catch (error) {
console.error('Failed to fetch user', error);
}
};
const login = async (email: string, password: string) => {
const response = await fetch('http://localhost:8000/api/v1/auth/jwt/create/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, password }),
});
if (!response.ok) {
throw new Error('Login failed');
}
const data = await response.json();
localStorage.setItem('access_token', data.access);
localStorage.setItem('refresh_token', data.refresh);
setAccessToken(data.access);
await fetchUser(data.access);
};
const logout = () => {
localStorage.removeItem('access_token');
localStorage.removeItem('refresh_token');
setAccessToken(null);
setUser(null);
};
const register = async (userData: any) => {
const response = await fetch('http://localhost:8000/api/v1/auth/users/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(userData),
});
if (!response.ok) {
throw new Error('Registration failed');
}
};
return (
<AuthContext.Provider value={{ user, login, logout, register }}>
{children}
</AuthContext.Provider>
);
}
export const useAuth = () => {
const context = useContext(AuthContext);
if (context === undefined) {
throw new Error('useAuth must be used within an AuthProvider');
}
return context;
};
```
---
## Error Handling
### Common Error Codes
| Status Code | Meaning | Common Causes |
|-------------|---------|---------------|
| 400 | Bad Request | Invalid data, validation errors |
| 401 | Unauthorized | Invalid credentials, expired token |
| 403 | Forbidden | Account not activated, permission denied |
| 404 | Not Found | Endpoint doesn't exist |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server-side error |
### Error Response Format
```json
{
"detail": "Error message here",
"field_name": ["Field-specific error"]
}
```
### Example: Registration Validation Error
```json
{
"email": ["A user with that email already exists."],
"password": ["This password is too common."]
}
```
---
## Testing with Postman/Insomnia
### 1. Register
```
POST http://localhost:8000/api/v1/auth/users/
Content-Type: application/json
{
"email": "test@example.com",
"password": "TestP@ssw0rd123",
"re_password": "TestP@ssw0rd123",
"first_name": "Test",
"last_name": "User"
}
```
### 2. Check Email (MailPit)
Open: `http://localhost:8025`
### 3. Activate Account
```
POST http://localhost:8000/api/v1/auth/users/activation/
Content-Type: application/json
{
"uid": "MQ",
"token": "c4h7vu-a8f3d2e1c4b5a6d7e8f9g0h1"
}
```
### 4. Login
```
POST http://localhost:8000/api/v1/auth/jwt/create/
Content-Type: application/json
{
"email": "test@example.com",
"password": "TestP@ssw0rd123"
}
```
### 5. Get User Profile
```
GET http://localhost:8000/api/v1/auth/users/me/
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
```
---
## Environment Variables
### Development (.env.dev)
```bash
DEBUG=True
SECRET_KEY=your-secret-key-here
ALLOWED_HOSTS=localhost,127.0.0.1
# Database
DATABASE_URL=sqlite:///db.sqlite3
# Email (MailPit)
EMAIL_HOST=localhost
EMAIL_PORT=1025
EMAIL_USE_TLS=False
# CORS
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173
```
### Production (.env.prod)
```bash
DEBUG=False
SECRET_KEY=your-production-secret-key
ALLOWED_HOSTS=yourdomain.com,api.yourdomain.com
# Database
DATABASE_URL=postgresql://user:pass@host:5432/dbname
# Email
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password
# Social Auth
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY=your-google-client-id
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET=your-google-client-secret
SOCIAL_AUTH_GITHUB_KEY=your-github-client-id
SOCIAL_AUTH_GITHUB_SECRET=your-github-client-secret
# CORS
CORS_ALLOWED_ORIGINS=https://yourdomain.com
```
---
## Support
Sorularınız için:
- GitHub Issues: [Your Repo]
- Email: support@yourdomain.com
- Documentation: [Your Docs URL]
---
**Last Updated:** 2025-12-12
**Version:** 1.0.0

145
BACKUP_SYSTEM_GUIDE.md Normal file
View File

@@ -0,0 +1,145 @@
# Veritabanı Yedekleme Sistemi - Kullanım Kılavuzu
## 🎯 Özellikler
### 1. 🔄 Yeni Yedek Al
Admin panel listesinde üstte bulunan **"Yeni Yedek Al"** butonuna tıklayarak anında yeni bir veritabanı yedeği oluşturabilirsiniz.
**Konum:** `/admin/backup/databasebackup/`
**Özellikler:**
- Tek tıkla yedek oluşturma
- Otomatik dosya adlandırma (ör: `backup_server_dj_20251224_152152.sql`)
- Gerçek zamanlı durum güncellemesi
- Başarı/hata mesajları
### 2. 📤 Yedek Yükle (YENİ!)
Elinizdeki SQL yedek dosyasını sisteme yükleyebilirsiniz.
**Konum:** `/admin/backup/databasebackup/` - Mavi "Yedek Yükle" butonu
**Özellikler:**
- Bilgisayarınızdan SQL dosyası yükleme
- Maksimum 500MB dosya boyutu
- Otomatik dosya validasyonu (.sql kontrolü)
- Timestamp ile dosya adlandırma
- Yüklenen dosyalar hemen kullanılabilir (geri yükleme, indirme)
**Kullanım:**
1. "Yedek Yükle" butonuna tıklayın
2. Yedek adı girin (opsiyonel)
3. SQL dosyasını seçin
4. "Yükle" butonuna tıklayın
### 3. 📥 Yedek İndirme
#### Yöntem 1: İndir Butonu (Önerilen)
Liste görünümünde her yedeğin yanında yeşil **"İndir"** butonu vardır.
- Sadece tamamlanmış yedekler için görünür
- Tek tıkla indirme
#### Yöntem 2: Admin Action
1. Listeden bir yedek seçin (checkbox)
2. Üstteki "Actions" dropdown menüsünden **"Seçili Yedeği İndir"** seçin
3. "Go" butonuna tıklayın
#### Yöntem 3: Direkt URL
```
/admin/backup/databasebackup/{backup_id}/download/
```
### 3. 🔄 Yedek Geri Yükleme
1. Listeden geri yüklenecek yedeği seçin
2. "Actions" dropdown → **"Seçili Yedeği Geri Yükle"**
3. "Go" butonuna tıklayın
**⚠️ Uyarı:** Geri yükleme işlemi mevcut veritabanını değiştirecektir. Dikkatli olun!
### 4. 🗑️ Yedek Silme
#### Dosyaları Silme (Kayıtları Koruma)
1. Silinecek yedekleri seçin
2. "Actions" dropdown → **"Yedek Dosyalarını Sil"**
3. Veritabanı kaydı kalır ama fiziksel dosya silinir
#### Tamamen Silme (Kayıt + Dosya)
1. Silinecek yedekleri seçin
2. "Actions" dropdown → **"Seçili veritabanı yedekleri siliniyor"** (varsayılan delete)
3. Hem kayıt hem fiziksel dosya silinir (post_delete signal sayesinde)
## 📊 Yedek Durumları
| Durum | Renk | Açıklama |
|-------|------|----------|
| 🟠 Bekliyor | Turuncu | Yedek oluşturulmayı bekliyor |
| 🔵 İşleniyor | Mavi | Yedek şu an oluşturuluyor |
| 🟢 Tamamlandı | Yeşil | Yedek başarıyla oluşturuldu |
| 🔴 Başarısız | Kırmızı | Yedek oluşturulurken hata oluştu |
## 🔧 Teknik Detaylar
### Yedek Dosyaları
- **Konum:** `/backups/` klasörü
- **Format:** SQL dump dosyası
- **Adlandırma:** `backup_server_dj_YYYYMMDD_HHMMSS.sql`
### Otomatik Temizleme
Django'nun `post_delete` sinyali kullanılarak, veritabanı kaydı silindiğinde ilgili SQL dosyası da otomatik olarak silinir.
### Güvenlik
- Sadece staff/admin kullanıcıları erişebilir
- Her yedek, oluşturan kullanıcı bilgisi ile birlikte kaydedilir
- Dosya boyutları otomatik hesaplanır
## 🚀 Kullanım Senaryoları
### Senaryo 1: Rutin Yedek Alma
1. Admin panele giriş yap
2. "Yeni Yedek Al" butonuna tıkla
3. Yedeğin tamamlanmasını bekle (sayfa otomatik yenilenir)
4. Gerekirse yedeği indir
### Senaryo 2: Harici Yedek Yükleme (YENİ!)
1. "Yedek Yükle" butonuna tıkla
2. Bilgisayarından veya başka sunucudan aldığın SQL dosyasını seç
3. Yedek adı ver (opsiyonel)
4. Yükle
5. Yüklenen yedek artık sistemde kullanılabilir
### Senaryo 3: Veri Geri Yükleme
1. Geri yüklenecek yedeği bul
2. Önce o yedeği indir (güvenlik için)
3. "Seçili Yedeği Geri Yükle" action'ını kullan
4. Onay mesajını bekle
### Senaryo 4: Eski Yedekleri Temizleme
1. Silinecek yedekleri seç (çoklu seçim mümkün)
2. İki seçenek:
- Sadece dosyaları sil (kayıt kalsın) → "Yedek Dosyalarını Sil"
- Her şeyi sil → Varsayılan delete action
## 📝 Notlar
- Yedekler PostgreSQL için optimize edilmiştir
- Büyük veritabanları için yedekleme işlemi zaman alabilir
- Yedek dosyaları düzenli olarak kontrol edilmelidir
- Production ortamında yedekleri farklı bir sunucuya da kopyalamanız önerilir
## 🆘 Sorun Giderme
### Yedek Oluşturulamıyor
- PostgreSQL bağlantı ayarlarını kontrol edin
- `backups/` klasörünün yazma izinlerini kontrol edin
- Error mesajına bakın (Yedek detayında gösterilir)
### İndirme Çalışmıyor
- Dosyanın hala diskte olduğundan emin olun
- Yedeğin durumunun "Tamamlandı" olduğunu kontrol edin
- Tarayıcı konsol hatalarına bakın
### Geri Yükleme Başarısız
- Yedek dosyasının bozuk olmadığından emin olun
- PostgreSQL kullanıcısının yeterli yetkileri olduğunu kontrol edin
- Veritabanı bağlantısının aktif olduğunu doğrulayın

114
COOLIFY_DEPLOYMENT.md Normal file
View File

@@ -0,0 +1,114 @@
# Coolify Deployment Guide - Django Project
## Deployment Yapılandırması
### Gerekli Environment Variables (Coolify'da ayarlanmalı):
```
SECRET_KEY=your-secret-key-here
USE_POSTGRES=1
POSTGRES_DB=your_db_name
POSTGRES_USER=your_db_user
POSTGRES_PASSWORD=your_db_password
POSTGRES_HOST=10.80.80.50
POSTGRES_PORT=5432
DJANGO_ALLOWED_HOSTS=your-domain.com,www.your-domain.com
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
```
### Docker Compose Dosyası
- **Kullanılacak Dosya**: `docker-compose.c.yml`
- **Network**: `coolify` (external)
- **Port**: 8400 (nginx)
### Önemli Notlar
#### 1. Nginx Configuration
- `./nginx/Dockerfile` ile custom nginx image build edilir
- `./nginx/default.conf` dosyası **build sırasında image içine COPY edilir** (mount edilmez)
- Bu sayede Coolify'da volume mount sorunları yaşanmaz
- Proxy hedefi: `django_web_prod:8000` (network alias kullanılır)
#### 2. Network Aliases
- **web servisi**: `django_web_prod` alias'ı ile erişilebilir
- **nginx servisi**: `nginx_proxy` alias'ı ile erişilebilir
- Bu alias'lar sayesinde Coolify'ın container isimlerine zaman damgası eklemesi sorun yaratmaz
#### 3. Volume Mounts
- `static_volume`: Django static dosyaları
- `media_volume`: Kullanıcı yüklemeleri
- Her iki volume da web, celery ve nginx servisleri arasında paylaşılır
#### 4. Healthcheck
- Nginx için healthcheck yapılandırılmış
- 30 saniye aralıklarla kontrol yapılır
- İlk başlangıçta 40 saniye beklenir
### Deployment Adımları (Coolify UI)
1. **Yeni Proje Oluştur**
- Git repository URL'ini ekle
- Branch seç (main/master)
2. **Docker Compose Ayarları**
- Compose file: `docker-compose.c.yml` seç
- Network: `coolify` (otomatik oluşturulur)
3. **Environment Variables Ekle**
- Yukarıdaki tüm değişkenleri Coolify UI'dan ekle
- SECRET_KEY için güvenli bir anahtar oluştur
4. **Build & Deploy**
- "Deploy" butonuna tıkla
- Build loglarını takip et
### Sorun Giderme
#### Problem: nginx container'da /etc/nginx/conf.d boş
**Çözüm**:
- Artık bu sorun yaşanmaz çünkü `default.conf` build sırasında image içine kopyalanır
- Eğer yine de boşsa, nginx image'ının doğru build edildiğini kontrol edin:
```bash
docker exec <nginx-container-name> ls -la /etc/nginx/conf.d/
docker exec <nginx-container-name> cat /etc/nginx/conf.d/default.conf
```
- Build loglarında `COPY nginx/default.conf` adımının başarılı olduğunu doğrulayın
#### Problem: django_web_prod çözümlenemiyor
**Çözüm**:
- `docker-compose.c.yml` içinde `web` servisinin network alias'ının `django_web_prod` olduğunu kontrol edin
- Tüm servisler aynı `coolify` network'üne bağlı olmalı
#### Problem: Static/Media dosyaları yüklenmiyor
**Çözüm**:
- Volume mount'ların doğru olduğunu kontrol edin
- Django collectstatic komutunu çalıştırın:
```bash
docker exec <web-container-name> python manage.py collectstatic --noinput
```
### Test Komutları
```bash
# Nginx config testi
docker exec <nginx-container-name> nginx -t
# Nginx içinden Django'ya erişim testi
docker exec <nginx-container-name> wget -qO- http://django_web_prod:8000
# Container logları
docker logs <container-name> -f
# Network yapısını kontrol
docker network inspect coolify
```
### Port Mapping
- **8400**: Nginx (HTTP)
- Coolify proxy üzerinden domain'e yönlendirilecek
### Güvenlik Notları
- DEBUG=0 production'da
- SECRET_KEY her ortam için farklı olmalı
- ALLOWED_HOSTS domain'lerinizi içermeli
- PostgreSQL credentials güvenli tutulmalı

311
COOLIFY_NGINX_DEBUG.md Normal file
View File

@@ -0,0 +1,311 @@
# Nginx-Django Bağlantı Sorunu Çözümü (Coolify)
## 🔧 Yapılan Düzeltmeler
### 1. Docker Compose Güncellemeleri
- ✅ Nginx için `ports: - "80:80"` eklendi (Coolify proxy için gerekli)
- ✅ Network alias düzeltildi: `nginx` ve `nginx_proxy`
- ✅ Doğru network yapılandırması: `coolify` (external)
### 2. Nginx Config Güncellemeleri
- ✅ Upstream block eklendi: `django_backend`
- ✅ İki farklı server tanımı:
- Primary: `django_web_prod:8000` (network alias)
- Backup: `web:8000` (servis adı)
- ✅ Timeout ayarları eklendi
- ✅ Connection timeout: 60s
## 🚀 Coolify'da Deploy
### Adım 1: Kod Değişikliklerini Push Edin
```bash
git add nginx/default.conf docker-compose.c.yml
git commit -m "Fix: Nginx-Django connection for Coolify"
git push
```
### Adım 2: Coolify'da Redeploy
1. Coolify dashboard → Projeniz
2. **Redeploy** butonuna tıklayın
3. Build loglarını izleyin
## 🔍 Deploy Sonrası Test Komutları
### 1. Container'ları Kontrol Edin
```bash
# Tüm container'ları listele
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
# Nginx ve web container'larını bulun
docker ps | grep -E "nginx|web"
```
### 2. Network Bağlantısını Test Edin
```bash
# Nginx container ID'sini bulun
NGINX_ID=$(docker ps | grep nginx | awk '{print $1}')
# Web container ID'sini bulun
WEB_ID=$(docker ps | grep "web" | grep -v nginx | awk '{print $1}')
# Nginx'ten Django'ya DNS çözümlemesi test et
docker exec $NGINX_ID nslookup django_web_prod
docker exec $NGINX_ID nslookup web
# Eğer nslookup yoksa:
docker exec $NGINX_ID getent hosts django_web_prod
docker exec $NGINX_ID getent hosts web
```
### 3. HTTP Bağlantısını Test Edin
```bash
# Nginx container'dan Django'ya wget ile test
docker exec $NGINX_ID wget -qO- http://django_web_prod:8000 || echo "HATA: django_web_prod çözülemiyor"
docker exec $NGINX_ID wget -qO- http://web:8000 || echo "HATA: web çözülemiyor"
# Curl kullanarak (eğer varsa)
docker exec $NGINX_ID curl -I http://django_web_prod:8000
```
### 4. Nginx Config ve Loglarını Kontrol Edin
```bash
# Nginx config test
docker exec $NGINX_ID nginx -t
# Nginx conf dosyasını görüntüle
docker exec $NGINX_ID cat /etc/nginx/conf.d/default.conf
# Nginx error logları
docker exec $NGINX_ID cat /var/log/nginx/error.log
# Nginx access logları
docker exec $NGINX_ID cat /var/log/nginx/access.log
# Real-time log izleme
docker logs -f $NGINX_ID
docker logs -f $WEB_ID
```
### 5. Network İnceleme
```bash
# Coolify network'ünü incele
docker network inspect coolify
# Hangi container'lar bu network'te?
docker network inspect coolify | grep -A 5 "Containers"
# Web container'ın IP adresini bul
docker inspect $WEB_ID | grep -A 10 "Networks" | grep "IPAddress"
# Nginx'ten web container IP'sine ping
docker exec $NGINX_ID ping -c 3 <web-container-ip>
```
## 🐛 Sorun Giderme
### Problem 1: "could not resolve host: django_web_prod"
**Sebep**: Network alias çözülmüyor.
**Çözüm**:
```bash
# docker-compose.c.yml içinde web servisinin network alias'ını kontrol edin:
cat docker-compose.c.yml | grep -A 5 "networks:" | grep -A 2 "aliases"
# Beklenen çıktı:
# aliases:
# - django_web_prod
# Eğer yoksa veya yanlışsa, compose dosyasını düzeltin ve redeploy edin
```
### Problem 2: "Connection refused"
**Sebep**: Django uygulaması çalışmıyor veya port 8000'de dinlemiyor.
**Çözüm**:
```bash
# Web container'ın loglarını kontrol edin
docker logs $WEB_ID --tail 100
# Django'nun port 8000'de dinlediğini kontrol edin
docker exec $WEB_ID netstat -tuln | grep 8000
# Veya
docker exec $WEB_ID ss -tuln | grep 8000
# Web container içinden kendine bağlanmayı deneyin
docker exec $WEB_ID curl -I http://localhost:8000
```
### Problem 3: "upstream timed out"
**Sebep**: Django yanıt vermesi çok uzun sürüyor.
**Çözüm**:
```bash
# Django loglarını kontrol edin
docker logs $WEB_ID -f
# Gunicorn worker sayısını artırın (docker-compose.c.yml):
# command: gunicorn core.wsgi:application --bind 0.0.0.0:8000 --workers 5
# Nginx timeout'ları artırın (default.conf zaten 60s):
# proxy_connect_timeout 120s;
# proxy_send_timeout 120s;
# proxy_read_timeout 120s;
```
### Problem 4: "502 Bad Gateway"
**Sebep**: Nginx Django'ya bağlanamıyor.
**Çözüm**:
```bash
# Tüm container'ların aynı network'te olduğunu doğrulayın
docker inspect $NGINX_ID | grep -A 10 "Networks"
docker inspect $WEB_ID | grep -A 10 "Networks"
# Her ikisi de "coolify" network'ünde olmalı
# Network alias'larını kontrol edin
docker network inspect coolify | jq '.[0].Containers'
# Nginx upstream config'ini kontrol edin
docker exec $NGINX_ID cat /etc/nginx/conf.d/default.conf | grep -A 3 "upstream"
```
### Problem 5: Static/Media dosyaları 404
**Sebep**: Volume mount sorunları.
**Çözüm**:
```bash
# Nginx container içinde volume'ların mount edildiğini kontrol edin
docker exec $NGINX_ID ls -la /app/staticfiles/
docker exec $NGINX_ID ls -la /app/media/
# Web container içinde static dosyaları kontrol edin
docker exec $WEB_ID ls -la /app/staticfiles/
# Collectstatic çalıştırın
docker exec $WEB_ID python manage.py collectstatic --noinput
```
## 📊 Beklenen Çıktılar
### Başarılı DNS Çözümlemesi
```bash
$ docker exec $NGINX_ID nslookup django_web_prod
Server: 127.0.0.11
Address: 127.0.0.11#53
Non-authoritative answer:
Name: django_web_prod
Address: 172.18.0.3 # IP değişebilir
```
### Başarılı HTTP Testi
```bash
$ docker exec $NGINX_ID wget -qO- http://django_web_prod:8000 | head -n 5
<!DOCTYPE html>
<html>
...
```
### Başarılı Nginx Config Test
```bash
$ docker exec $NGINX_ID nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
```
## 🎯 Upstream Stratejisi
Nginx config'de şu upstream stratejisi kullanılıyor:
```nginx
upstream django_backend {
server django_web_prod:8000 max_fails=3 fail_timeout=30s;
server web:8000 backup;
}
```
**Nasıl Çalışır**:
1. İlk olarak `django_web_prod:8000` (network alias) denenir
2. Eğer 3 kez başarısız olursa, 30 saniye fail olarak işaretlenir
3. Backup olarak `web:8000` (servis adı) kullanılır
4. Bu sayede her iki DNS çözümleme yöntemi de desteklenir
## 📝 Kontrol Listesi
Deploy öncesi:
- [ ] `nginx/default.conf` dosyası upstream block içeriyor
- [ ] `docker-compose.c.yml` içinde nginx ports tanımı var
- [ ] `docker-compose.c.yml` içinde web servisi network alias'ı `django_web_prod`
- [ ] Her iki servis de `coolify` network'üne bağlı
- [ ] Git'e push edildi
Deploy sonrası:
- [ ] Container'lar ayakta: `docker ps`
- [ ] DNS çözümlemesi çalışıyor: `nslookup django_web_prod`
- [ ] HTTP bağlantısı çalışıyor: `wget http://django_web_prod:8000`
- [ ] Nginx config geçerli: `nginx -t`
- [ ] Nginx loglarında hata yok
- [ ] Browser'dan site açılıyor
## 🔗 Hızlı Debug Script
Aşağıdaki script'i Coolify sunucusunda çalıştırarak tüm testleri yapabilirsiniz:
```bash
#!/bin/bash
# nginx-django-debug.sh
echo "=== CONTAINER STATUS ==="
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep -E "nginx|web|NAME"
NGINX_ID=$(docker ps | grep nginx | awk '{print $1}')
WEB_ID=$(docker ps | grep "web" | grep -v nginx | awk '{print $1}')
echo -e "\n=== DNS RESOLUTION TEST ==="
echo "Testing django_web_prod:"
docker exec $NGINX_ID nslookup django_web_prod 2>&1 || echo "FAILED"
echo "Testing web:"
docker exec $NGINX_ID nslookup web 2>&1 || echo "FAILED"
echo -e "\n=== HTTP CONNECTION TEST ==="
echo "Testing http://django_web_prod:8000:"
docker exec $NGINX_ID wget -qO- http://django_web_prod:8000 2>&1 | head -n 3
echo "Testing http://web:8000:"
docker exec $NGINX_ID wget -qO- http://web:8000 2>&1 | head -n 3
echo -e "\n=== NGINX CONFIG TEST ==="
docker exec $NGINX_ID nginx -t
echo -e "\n=== NGINX ERROR LOG (last 10 lines) ==="
docker exec $NGINX_ID tail -n 10 /var/log/nginx/error.log 2>&1 || echo "No errors"
echo -e "\n=== WEB CONTAINER LOG (last 10 lines) ==="
docker logs $WEB_ID --tail 10
echo -e "\n=== NETWORK INFO ==="
docker network inspect coolify | grep -A 20 "Containers"
echo -e "\n=== DONE ==="
```
Kullanım:
```bash
chmod +x nginx-django-debug.sh
./nginx-django-debug.sh
```
## ✅ Başarı Kriterleri
Eğer aşağıdakiler çalışıyorsa, sorun çözülmüştür:
1.`docker ps` ile nginx ve web container'ları görünüyor
2.`docker exec <nginx-id> nslookup django_web_prod` çalışıyor
3.`docker exec <nginx-id> wget -qO- http://django_web_prod:8000` HTML dönüyor
4.`docker exec <nginx-id> nginx -t` başarılı
5. ✅ Browser'dan Coolify domain'e girdiğinizde Django uygulamasıılıyor
---
**Son Güncelleme**: 29 Ocak 2026
**Durum**: Nginx upstream stratejisi eklendi, Coolify uyumlu

254
COOLIFY_NO_PORT_MAPPING.md Normal file
View File

@@ -0,0 +1,254 @@
# ✅ Coolify Deployment - Doğru Yapılandırma
## 🎯 Önemli: Port Mapping Yok!
Coolify kendi reverse proxy'sini kullanır, bu yüzden:
-**`ports: - "80:80"` kullanmayın** (conflict yaratır)
-**Sadece `expose: - 80`** kullanın (internal)
-**Coolify labels eklenmeli** (Coolify'ın nginx'i bulması için)
## 📋 Güncel Yapılandırma
### docker-compose.c.yml (nginx servisi)
```yaml
nginx:
build:
context: .
dockerfile: ./nginx/Dockerfile
expose:
- 80 # ✅ Internal port (Coolify için)
networks:
coolify:
aliases:
- nginx
- nginx_proxy
labels:
- "coolify.managed=true" # ✅ Coolify tarafından yönetiliyor
- "coolify.http.port=80" # ✅ Coolify'a hangi port dinlediğini söyler
```
## 🔄 Coolify Proxy Akışı
```
Internet
Coolify Reverse Proxy (Caddy/Traefik)
[your-domain.com]
Internal: nginx:80 (exposed, not published)
Internal: django_web_prod:8000
Django App
```
## 🚀 Deploy Adımları
### 1. Git Push
```bash
git add docker-compose.c.yml
git commit -m "Fix: Remove port mapping for Coolify proxy"
git push
```
### 2. Coolify Dashboard
1. Projenize gidin
2. **Settings****General**
3. **Port** kısmında `80` olduğunu doğrulayın
4. **Redeploy** butonuna tıklayın
### 3. Domain Ayarları
Coolify'da:
- **Domains** sekmesinde domain'inizi ekleyin
- Coolify otomatik olarak SSL sertifikası alacak (Let's Encrypt)
- Coolify proxy'si nginx container'ın 80 portuna yönlendirecek
## 🔍 Test Komutları
Deploy sonrası Coolify sunucusunda:
```bash
# Container'ları kontrol edin
docker ps | grep -E "nginx|web"
# Nginx container ID
NGINX_ID=$(docker ps | grep nginx | head -1 | awk '{print $1}')
# Internal DNS testi (nginx container içinden)
docker exec $NGINX_ID nslookup django_web_prod
# Internal HTTP testi
docker exec $NGINX_ID wget -qO- http://django_web_prod:8000 | head
# Nginx config doğrulama
docker exec $NGINX_ID nginx -t
# Nginx logları
docker logs $NGINX_ID --tail 50
# Coolify network kontrolü
docker network inspect coolify | grep -A 5 "nginx"
```
## ✅ Başarı Kriterleri
- [ ] `docker ps` - Nginx container çalışıyor, **port mapping YOK** (80/tcp yazıyor ama 0.0.0.0:80->80/tcp yazmıyor)
- [ ] Internal DNS - `docker exec $NGINX_ID nslookup django_web_prod` çalışıyor
- [ ] Internal HTTP - `docker exec $NGINX_ID wget http://django_web_prod:8000` çalışıyor
- [ ] Nginx config - `docker exec $NGINX_ID nginx -t` başarılı
- [ ] **Browser** - Coolify domain'den (örn: https://yourdomain.com) site açılıyor
- [ ] **SSL** - Coolify otomatik HTTPS yönlendirmesi çalışıyor
## 📊 Beklenen `docker ps` Çıktısı
```bash
CONTAINER ID IMAGE PORTS NAMES
abc123 nginx:alpine 80/tcp django_nginx # ✅ Doğru (exposed)
def456 python:3.14 8000/tcp django_web_prod # ✅ Doğru (exposed)
# ❌ YANLIŞ olacak:
# 0.0.0.0:80->80/tcp # Bu Coolify ile conflict yaratır
```
Port sütununda sadece `80/tcp` görünmeli, `0.0.0.0:80->80/tcp` **görünmemeli**.
## 🐛 Sorun Giderme
### Problem: "Port 80 already in use"
**Sebep**: `ports:` tanımı hala var.
**Çözüm**:
```yaml
# ❌ YANLIŞ
nginx:
ports:
- "80:80"
# ✅ DOĞRU
nginx:
expose:
- 80
```
### Problem: "502 Bad Gateway" (Coolify domain'den)
**Sebep**: Coolify nginx container'ı bulamıyor.
**Çözüm**:
```bash
# Labels kontrolü
docker inspect $(docker ps | grep nginx | awk '{print $1}') | grep -A 5 "Labels"
# Beklenen:
# "coolify.managed": "true"
# "coolify.http.port": "80"
# Eğer yoksa docker-compose.c.yml'e ekleyin ve redeploy edin
```
### Problem: Nginx Django'ya bağlanamıyor
**Sebep**: Network alias veya DNS problemi.
**Çözüm**:
```bash
# Web container'ın network alias'ını kontrol edin
docker inspect $(docker ps | grep "web" | grep -v nginx | awk '{print $1}') | grep -A 10 "Aliases"
# Beklenen: "django_web_prod" görünmeli
# Eğer yoksa docker-compose.c.yml içinde web servisine ekleyin:
services:
web:
networks:
coolify:
aliases:
- django_web_prod
```
### Problem: Static/Media dosyaları yüklenmiyor
**Sebep**: Volume mount veya nginx config.
**Çözüm**:
```bash
# Volume kontrolü
docker exec $NGINX_ID ls -la /app/staticfiles/
docker exec $NGINX_ID ls -la /app/media/
# Eğer boşsa:
WEB_ID=$(docker ps | grep "web" | grep -v nginx | awk '{print $1}')
docker exec $WEB_ID python manage.py collectstatic --noinput
# Nginx config kontrolü
docker exec $NGINX_ID cat /etc/nginx/conf.d/default.conf | grep -A 3 "location /static"
```
## 🎯 Coolify'a Özel Notlar
### 1. Port Exposure
- Coolify container'ların **exposed** portlarını otomatik keşfeder
- `expose: - 80` yeterli, `ports:` gereksiz ve zararlı
### 2. Labels
```yaml
labels:
- "coolify.managed=true" # Coolify'ın yönetiminde
- "coolify.http.port=80" # HTTP trafiği için port
# - "coolify.https.port=443" # Eğer internal HTTPS varsa (şu an gerekli değil)
```
### 3. Network
```yaml
networks:
coolify:
external: true # Coolify tarafından oluşturulan network
```
### 4. Domain Routing
Coolify dashboard:
- **Domains** → Domain ekleyin (örn: `example.com`, `www.example.com`)
- **HTTPS** → Otomatik Let's Encrypt (default açık)
- **Redirect** → HTTP → HTTPS yönlendirme (önerilir)
### 5. Health Check
Coolify nginx'in sağlık durumunu kontrol eder:
- Dockerfile içindeki `HEALTHCHECK` direktifi kullanılır
- Eğer container unhealthy olursa otomatik restart edilir
## 📝 Checklist - Coolify Deploy
Öncesi:
- [ ] `ports:` tanımı **yok**, sadece `expose:` var
- [ ] Coolify labels eklenmiş
- [ ] Network `coolify` ve `external: true`
- [ ] `nginx/default.conf` upstream stratejisi var
- [ ] Git'e push edildi
Sonrası (Coolify Dashboard):
- [ ] Build başarılı
- [ ] Container başlatıldı
- [ ] Health check geçti
- [ ] Domain'e HTTPS ile erişim var
- [ ] Static/Media dosyaları yükleniyor
Sonrası (Terminal):
- [ ] `docker ps` - Nginx container çalışıyor (80/tcp)
- [ ] `docker exec ... nslookup django_web_prod` - Başarılı
- [ ] `docker exec ... wget http://django_web_prod:8000` - Django yanıtlıyor
- [ ] `docker exec ... nginx -t` - Config geçerli
- [ ] Nginx error.log temiz
## 🌐 Production Checklist
- [ ] **SSL**: Let's Encrypt sertifikası aktif
- [ ] **Redirect**: HTTP → HTTPS yönlendirme aktif
- [ ] **Static**: CSS/JS dosyaları yükleniyor
- [ ] **Media**: Kullanıcı yüklemeleri çalışıyor
- [ ] **Admin**: `/admin` paneli açılıyor
- [ ] **API**: API endpoint'leri yanıt veriyor
- [ ] **Logs**: Hata logları temiz
- [ ] **Monitoring**: Coolify metrics'te trafik görünüyor
---
**Oluşturulma**: 29 Ocak 2026
**Coolify Versiyonu**: v4.x
**Durum**: ✅ Production Ready

194
COPILOT_MEMORY.md Normal file
View File

@@ -0,0 +1,194 @@
# Copilot Memory - Django Auth System Development
Bu dosya, Django 6.0 projemizde Custom User + Djoser + JWT + Social Auth sisteminin geliştirilme sürecini takip eder.
---
## 2025-12-12T21:35:00Z
### ✅ Değişiklik Özeti: İlk Kurulum - Custom User Model ve Auth Sistemi Temeli
**Tamamlanan İşler:**
1. **Custom User Model Oluşturuldu** (`accounts/models.py`)
- `CustomUser` modeli: Email tabanlı authentication (username yok)
- `CustomUserManager`: `create_user` ve `create_superuser` metodları
- Alanlar: `email` (unique), `first_name`, `last_name`, `is_staff`, `is_active`, `date_joined`
- `USERNAME_FIELD = "email"`
2. **Admin Panel Konfigürasyonu** (`accounts/admin.py`)
- `CustomUserAdmin` sınıfı ile Django admin'de custom user yönetimi
- List display, filters, search fields yapılandırıldı
3. **Serializers Oluşturuldu** (`accounts/serializers.py`)
- `CustomUserCreateSerializer`: Register için, `is_active=False` set eder
- `CustomUserSerializer`: User profil bilgileri için
- `SocialLoginSerializer`: Social auth için provider + access_token
4. **Social Auth Pipeline** (`accounts/pipeline.py`)
- `activate_user` fonksiyonu: Social login ile gelen kullanıcıları otomatik aktif eder
- Normal register: `is_active=False` (email aktivasyon gerekli)
- Social register: `is_active=True` (direkt aktif)
5. **Social Login View** (`accounts/views.py`)
- `SocialLoginView`: Provider token'ı doğrular, user oluşturur/bulur, JWT döner
- Desteklenen provider'lar: google-oauth2, github, facebook
- Error handling: AuthForbidden, AuthException, genel hatalar
6. **Settings.py Tam Konfigürasyonu** (`core/settings.py`)
- `AUTH_USER_MODEL = 'accounts.CustomUser'`
- `INSTALLED_APPS`: rest_framework, rest_framework_simplejwt, djoser, corsheaders, social_django, accounts
- **REST_FRAMEWORK**: JWT authentication, throttling (100/hour anon, 1000/hour user)
- **SIMPLE_JWT**: 60 min access, 7 days refresh, token rotation, blacklist
- **DJOSER**: Email activation, custom serializers, password reset
- **EMAIL**: MailPit (localhost:1025) dev için, production için SMTP placeholder
- **CORS**: localhost:3000, 5173, 8080 (Nuxt/Next/Vue için)
- **SOCIAL_AUTH**: Google, GitHub, Facebook backends + custom pipeline
7. **Email Templates Oluşturuldu** (`templates/email/`)
- `activation_email.html` / `.txt`: Hesap aktivasyon emaili
- `confirmation_email.html` / `.txt`: Aktivasyon başarılı emaili
- `password_reset_email.html` / `.txt`: Şifre sıfırlama emaili
- Modern, responsive HTML tasarım + plain text alternatifi
8. **URL Routing** (`accounts/urls.py`)
- Djoser endpoints: `/api/v1/auth/users/` (register), `/api/v1/auth/users/activation/` (activate)
- JWT endpoints: `/api/v1/auth/jwt/create/` (login), `/api/v1/auth/jwt/refresh/`
- Social auth: `/api/v1/auth/social/<provider>/`
- Python Social Auth URLs: `/api/v1/social/`
9. **Database Migrations**
- `accounts/migrations/0001_initial.py`: CustomUser model
- `social_django` migrations: Social auth tabloları
- Tüm migration'lar başarıyla uygulandı (migrate completed)
### 📁 Değiştirilen/Oluşturulan Dosyalar:
- `accounts/models.py` (yeni)
- `accounts/admin.py` (güncellendi)
- `accounts/serializers.py` (yeni)
- `accounts/pipeline.py` (yeni)
- `accounts/views.py` (güncellendi)
- `accounts/urls.py` (güncellendi)
- `accounts/migrations/0001_initial.py` (oluşturuldu)
- `core/settings.py` (kapsamlı güncelleme)
- `templates/email/activation_email.html` (yeni)
- `templates/email/activation_email.txt` (yeni)
- `templates/email/confirmation_email.html` (yeni)
- `templates/email/confirmation_email.txt` (yeni)
- `templates/email/password_reset_email.html` (yeni)
- `templates/email/password_reset_email.txt` (yeni)
### 🎯 Sistem Özellikleri:
**Authentication Akışları:**
1. **Normal Register (Email/Password):**
```
POST /api/v1/auth/users/
Body: { "email", "password", "re_password", "first_name", "last_name" }
→ User oluşturulur (is_active=False)
→ Aktivasyon emaili gönderilir
→ POST /api/v1/auth/users/activation/ { "uid", "token" }
→ is_active=True olur
→ POST /api/v1/auth/jwt/create/ { "email", "password" }
→ JWT tokens alınır
```
2. **Social Login:**
```
POST /api/v1/auth/social/google-oauth2/
Body: { "access_token": "..." }
→ Provider'dan user bilgisi alınır
→ User bulunur/oluşturulur (is_active=True)
→ JWT tokens direkt döner
```
3. **Login:**
```
POST /api/v1/auth/jwt/create/
Body: { "email", "password" }
→ Access + Refresh token döner
```
4. **Token Refresh:**
```
POST /api/v1/auth/jwt/refresh/
Body: { "refresh": "..." }
→ Yeni access token döner
```
### ⚙️ Yapılandırma Gereksinimleri:
**Environment Variables (Production için):**
```bash
# Email
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password
DEFAULT_FROM_EMAIL=noreply@yourdomain.com
# Social Auth - Google
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY=your-google-client-id
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET=your-google-client-secret
# Social Auth - GitHub
SOCIAL_AUTH_GITHUB_KEY=your-github-client-id
SOCIAL_AUTH_GITHUB_SECRET=your-github-client-secret
# Social Auth - Facebook
SOCIAL_AUTH_FACEBOOK_KEY=your-facebook-app-id
SOCIAL_AUTH_FACEBOOK_SECRET=your-facebook-app-secret
```
**Development Tools:**
- MailPit: `localhost:1025` (SMTP), `localhost:8025` (Web UI)
- Database: SQLite (db.sqlite3)
### 📝 Next Steps:
1. **Testing (Yüksek Öncelik):**
- [ ] Unit tests: Register → is_active=False check
- [ ] Unit tests: Activation → is_active=True check
- [ ] Unit tests: Login → aktif/inaktif user scenarios
- [ ] Unit tests: Social login → user creation + JWT response
- [ ] Integration tests: Full auth flow
2. **Dokümantasyon:**
- [ ] `AUTH.md` oluştur: Tüm endpoint'ler, request/response örnekleri
- [ ] Frontend entegrasyon kılavuzu (Nuxt.js + Next.js)
- [ ] Environment variables dokümantasyonu
- [ ] Deployment checklist
3. **İyileştirmeler:**
- [ ] Rate limiting test et
- [ ] Email template'lerini test et (MailPit ile)
- [ ] Social auth provider'ları test et
- [ ] Error mesajlarını frontend-friendly hale getir
- [ ] Logging ekle (özellikle auth failures için)
4. **Güvenlik:**
- [ ] HTTPS için production settings
- [ ] CSRF token stratejisi netleştir
- [ ] JWT secret key'i environment variable'a taşı
- [ ] Rate limiting değerlerini production için ayarla
5. **Opsiyonel Özellikler:**
- [ ] Email değiştirme flow'u
- [ ] 2FA (Two-Factor Authentication)
- [ ] Remember me functionality
- [ ] Account deletion
- [ ] Social account linking (birden fazla provider)
### 🐛 Bilinen Sorunlar:
- Yok (şu an için)
### 📚 Referanslar:
- Djoser Docs: https://djoser.readthedocs.io/
- SimpleJWT Docs: https://django-rest-framework-simplejwt.readthedocs.io/
- Python Social Auth: https://python-social-auth.readthedocs.io/
- Django REST Framework: https://www.django-rest-framework.org/
---

207
DOCKER_README.md Normal file
View File

@@ -0,0 +1,207 @@
# Django Projesi - Docker Kurulum Rehberi
Bu Django projesi Python 3.14.2 ile dockerize edilmiştir.
## 📋 Gereksinimler
- Docker
- Docker Compose
## 🚀 Hızlı Başlangıç
### Geliştirme Ortamı (Development)
1. **Projeyi klonlayın ve dizine girin:**
```bash
cd /path/to/project
```
2. **Docker container'ları başlatın:**
```bash
docker-compose up --build
```
3. **Tarayıcınızda açın:**
```
http://localhost:8000
```
### Production Ortamı
1. **Environment dosyasını oluşturun:**
```bash
cp .env.example .env
# .env dosyasını düzenleyin ve gerçek değerleri girin
```
2. **Production container'ları başlatın:**
```bash
docker-compose -f docker-compose.prod.yml up --build -d
```
3. **Nginx üzerinden erişin:**
```
http://localhost
```
## 🛠️ Yararlı Komutlar
### Container'ları Başlatma
```bash
# Geliştirme
docker-compose up
# Production
docker-compose -f docker-compose.prod.yml up -d
# Rebuild ile başlatma
docker-compose up --build
```
### Container'ları Durdurma
```bash
docker-compose down
# Volume'leri de silmek için
docker-compose down -v
```
### Django Komutları Çalıştırma
```bash
# Migration oluşturma
docker-compose exec web python manage.py makemigrations
# Migration uygulama
docker-compose exec web python manage.py migrate
# Superuser oluşturma
docker-compose exec web python manage.py createsuperuser
# Shell açma
docker-compose exec web python manage.py shell
# Static dosyaları toplama
docker-compose exec web python manage.py collectstatic
```
### Logları Görüntüleme
```bash
# Tüm servislerin logları
docker-compose logs -f
# Sadece web servisinin logları
docker-compose logs -f web
# Sadece database logları
docker-compose logs -f db
```
### Container'a Bağlanma
```bash
# Web container'a bash ile bağlan
docker-compose exec web bash
# Database container'a bağlan
docker-compose exec db psql -U server_dj -d server_dj
```
## 📁 Proje Yapısı
```
.
├── Dockerfile # Ana Docker image tanımı
├── docker-compose.yml # Geliştirme ortamı yapılandırması
├── docker-compose.prod.yml # Production ortamı yapılandırması
├── entrypoint.sh # Container başlatma scripti
├── nginx.conf # Nginx yapılandırması (production)
├── .dockerignore # Docker'a dahil edilmeyecek dosyalar
├── .env.example # Environment değişkenleri şablonu
└── requirements.txt # Python bağımlılıkları
```
## 🔧 Konfigürasyon
### Environment Değişkenleri
`.env` dosyasında aşağıdaki değişkenleri ayarlayabilirsiniz:
- `DEBUG`: Debug modu (0 veya 1)
- `SECRET_KEY`: Django secret key
- `DJANGO_ALLOWED_HOSTS`: İzin verilen host'lar
- `POSTGRES_DB`: PostgreSQL veritabanı adı
- `POSTGRES_USER`: PostgreSQL kullanıcı adı
- `POSTGRES_PASSWORD`: PostgreSQL şifresi
### Veritabanı
Proje hem SQLite hem de PostgreSQL destekler:
- **Development**: SQLite (varsayılan)
- **Production**: PostgreSQL (docker-compose ile)
### Static ve Media Dosyaları
- Static dosyalar: `/app/staticfiles`
- Media dosyaları: `/app/media`
- Her ikisi de Docker volume'lerinde saklanır
## 🔐 Güvenlik
Production ortamında:
1. `.env` dosyasındaki tüm varsayılan şifreleri değiştirin
2. `SECRET_KEY` için güçlü bir değer kullanın
3. `DEBUG=0` olarak ayarlayın
4. `ALLOWED_HOSTS` değerini doğru domain ile güncelleyin
5. SSL sertifikası ekleyin (nginx yapılandırmasına)
## 📊 Veritabanı Yedekleme
### PostgreSQL Backup
```bash
# Backup alma
docker-compose exec db pg_dump -U server_dj server_dj > backup.sql
# Backup geri yükleme
docker-compose exec -T db psql -U server_dj server_dj < backup.sql
```
## 🐛 Sorun Giderme
### Port zaten kullanımda
```bash
# Port 8000'i kullanan process'i bul
lsof -i :8000
# Veya farklı port kullan
# docker-compose.yml'de ports kısmını değiştirin
```
### Container başlamıyor
```bash
# Logları kontrol et
docker-compose logs web
# Container'ları temizle ve yeniden başlat
docker-compose down -v
docker-compose up --build
```
### Static dosyalar yüklenmiyor
```bash
# Static dosyaları yeniden topla
docker-compose exec web python manage.py collectstatic --noinput --clear
```
## 📝 Notlar
- İlk çalıştırmada `entrypoint.sh` otomatik olarak:
- Database migration'larını uygular
- Admin kullanıcısı oluşturur (admin/admin)
- Static dosyaları toplar
- Development ortamında kod değişiklikleri otomatik olarak yansır (volume mount sayesinde)
## 📞 Destek
Herhangi bir sorun için issue açabilirsiniz.

View File

@@ -0,0 +1,135 @@
# Django Projesi - Docker ile Mevcut PostgreSQL Kullanımı
**Projeniz başarıyla dockerize edildi ve çalışıyor!**
Bu yapılandırma, mevcut PostgreSQL sunucunuzu (10.80.80.50:5432) kullanarak Django projenizi Docker'da çalıştırır.
## 🎉 Test Edildi ve Çalışıyor
Server `http://localhost:8000` adresinde çalışıyor!
**Oluşturulan Admin Kullanıcısı:**
- Email: `admin@example.com`
- Şifre: `admin`
## ✅ Yapılan Değişiklikler
1. **PostgreSQL Container'ı kaldırıldı** - Mevcut sunucunuz kullanılacak
2. **[settings.py](core/settings.py)** - Environment değişkenleri ile PostgreSQL yapılandırması
3. **[docker-compose.yml](docker-compose.yml)** - Sadece web servisi (mevcut PostgreSQL'e bağlanır)
4. **[docker-compose.prod.yml](docker-compose.prod.yml)** - Production yapılandırması güncellendi
5. **[entrypoint.sh](entrypoint.sh)** - PostgreSQL bekleme kodu kaldırıldı
## 🚀 Kullanım
### Geliştirme Ortamı
```bash
# Docker container'ı başlat
docker-compose up --build
# Tarayıcıda aç
# http://localhost:8000
```
Container otomatik olarak 10.80.80.50:5432 adresindeki PostgreSQL sunucunuza bağlanacak.
### Production Ortamı
```bash
# .env dosyasını oluştur
cp .env.example .env
# .env dosyasını düzenle (gerekirse PostgreSQL bilgilerini güncelle)
# Production container'ları başlat
docker-compose -f docker-compose.prod.yml up -d
```
## 🔧 PostgreSQL Bağlantı Ayarları
Docker container'ınız şu ayarlarla PostgreSQL'e bağlanır:
```
Host: 10.80.80.50
Port: 5432
Database: server_dj
User: server_dj
Password: 1234
```
Bu ayarları değiştirmek için:
**Geliştirme:** [docker-compose.yml](docker-compose.yml) içindeki environment değişkenlerini düzenleyin
**Production:** `.env` dosyasını düzenleyin
### SQLite Kullanmak İsterseniz
```bash
# docker-compose.yml içinde USE_POSTGRES değişkenini değiştirin:
- USE_POSTGRES=False
```
## 📋 Yararlı Komutlar
```bash
# Migration uygula
docker-compose exec web python manage.py migrate
# Superuser oluştur
docker-compose exec web python manage.py createsuperuser
# Shell aç
docker-compose exec web python manage.py shell
# Logları görüntüle
docker-compose logs -f web
# Container'ı durdur
docker-compose down
```
## 🔍 Sorun Giderme
### PostgreSQL'e bağlanamıyorum
1. PostgreSQL sunucusunun çalıştığından emin olun
2. Docker container'ından 10.80.80.50:5432 adresine erişilebildiğini kontrol edin:
```bash
docker-compose exec web bash
apt-get update && apt-get install -y postgresql-client
psql -h 10.80.80.50 -U server_dj -d server_dj
```
### Mac'te Docker Network Sorunu
Mac'te Docker Desktop kullanıyorsanız ve localhost PostgreSQL'e bağlanamıyorsanız:
[docker-compose.yml](docker-compose.yml) içinde:
```yaml
environment:
- POSTGRES_HOST=host.docker.internal # 10.80.80.50 yerine
```
## 📁 Dosya Yapısı
```
.
├── Dockerfile # Django container image
├── docker-compose.yml # Geliştirme (mevcut PostgreSQL kullanır)
├── docker-compose.prod.yml # Production (mevcut PostgreSQL kullanır)
├── entrypoint.sh # Container başlatma scripti
├── nginx.conf # Nginx config (production)
├── .env.example # Environment değişkenleri
└── core/
└── settings.py # PostgreSQL ayarları (env değişkenlerinden)
```
## Notlar
- Container içinden `10.80.80.50` adresine erişmek için ağ yapılandırmanızın buna izin vermesi gerekir
- Production ortamında `.env` dosyasındaki şifreleri mutlaka değiştirin
- İlk çalıştırmada migrations otomatik uygulanır
- Static dosyalar otomatik toplanır

41
Dockerfile Normal file
View File

@@ -0,0 +1,41 @@
# Python 3.14.2 base image kullan
FROM python:3.14.2-slim
# Çalışma ortamı değişkenlerini ayarla
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
# Çalışma dizinini oluştur
WORKDIR /app
# Sistem bağımlılıklarını yükle (PostgreSQL ve diğer gerekli paketler için)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
postgresql-client \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Python bağımlılıklarını kopyala ve yükle
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Proje dosyalarını kopyala
COPY . .
# Static dosyaları topla
RUN python manage.py collectstatic --noinput --clear || true
# Media ve staticfiles dizinlerini oluştur
RUN mkdir -p /app/media /app/staticfiles
# Port 8000'i aç
EXPOSE 8000
# Entrypoint scriptini çalıştırılabilir yap
RUN chmod +x /app/entrypoint.sh || true
# Entrypoint ve varsayılan komut
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["gunicorn", "core.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3"]

475
FRONTEND_INTEGRATION.md Normal file
View File

@@ -0,0 +1,475 @@
# Frontend Integration Guide (Nuxt.js / Next.js)
## 🎯 Architecture
```
Frontend (Nuxt/Next.js) Backend (Django)
Port: 3000 Port: 8000
├── Pages/Routes ├── API Endpoints
├── UI/UX ├── Authentication
├── API Calls ├── Database
└── Token Storage └── Business Logic
```
---
## 📧 Email Links Flow
### How It Works:
1. **User registers** → Backend sends email
2. **Email contains** → Frontend URL (http://localhost:3000/activate/...)
3. **User clicks link** → Opens Frontend page
4. **Frontend JavaScript** → Calls Backend API
5. **Backend** → Activates account, returns response
6. **Frontend** → Shows success message
### Email Link Format:
```
Activation: http://localhost:3000/activate/{uid}/{token}/
Password Reset: http://localhost:3000/password-reset/{uid}/{token}/
```
---
## 🚀 Nuxt.js Implementation
### 1. Environment Variables (`.env`)
```bash
# Nuxt.js .env
NUXT_PUBLIC_API_BASE=http://localhost:8000/api/v1
```
### 2. Nuxt Config (`nuxt.config.ts`)
```typescript
export default defineNuxtConfig({
runtimeConfig: {
public: {
apiBase: process.env.NUXT_PUBLIC_API_BASE || 'http://localhost:8000/api/v1'
}
},
// CORS configuration for development
nitro: {
devProxy: {
'/api': {
target: 'http://localhost:8000',
changeOrigin: true
}
}
}
})
```
### 3. API Composable (`composables/useApi.ts`)
```typescript
export const useApi = () => {
const config = useRuntimeConfig()
const apiBase = config.public.apiBase
return {
apiBase,
async fetch(endpoint: string, options: any = {}) {
return await $fetch(`${apiBase}${endpoint}`, options)
}
}
}
```
### 4. Auth Composable (`composables/useAuth.ts`)
```typescript
export const useAuth = () => {
const { apiBase } = useApi()
const router = useRouter()
// Register
const register = async (userData: {
email: string
password: string
re_password: string
first_name: string
last_name: string
}) => {
return await $fetch(`${apiBase}/auth/users/`, {
method: 'POST',
body: userData
})
}
// Activate Account
const activate = async (uid: string, token: string) => {
return await $fetch(`${apiBase}/auth/users/activation/`, {
method: 'POST',
body: { uid, token }
})
}
// Login
const login = async (email: string, password: string) => {
const data = await $fetch(`${apiBase}/auth/jwt/create/`, {
method: 'POST',
body: { email, password }
})
// Save tokens
localStorage.setItem('access_token', data.access)
localStorage.setItem('refresh_token', data.refresh)
return data
}
// Social Login
const socialLogin = async (provider: string, accessToken: string) => {
const data = await $fetch(`${apiBase}/auth/social/${provider}/`, {
method: 'POST',
body: { access_token: accessToken }
})
// Save JWT tokens
localStorage.setItem('access_token', data.access)
localStorage.setItem('refresh_token', data.refresh)
return data
}
// Get Current User
const getUser = async () => {
const token = localStorage.getItem('access_token')
if (!token) return null
return await $fetch(`${apiBase}/auth/users/me/`, {
headers: {
Authorization: `Bearer ${token}`
}
})
}
// Logout
const logout = () => {
localStorage.removeItem('access_token')
localStorage.removeItem('refresh_token')
router.push('/login')
}
return {
register,
activate,
login,
socialLogin,
getUser,
logout
}
}
```
### 5. Activation Page (`pages/activate/[uid]/[token].vue`)
```vue
<template>
<div class="activation-page">
<div v-if="loading" class="loading">
<div class="spinner"></div>
<h1>Activating Your Account...</h1>
<p>Please wait while we activate your account.</p>
</div>
<div v-else-if="success" class="success">
<div class="icon"></div>
<h1>Account Activated!</h1>
<p>Your account has been successfully activated.</p>
<NuxtLink to="/login" class="btn">Go to Login</NuxtLink>
</div>
<div v-else class="error">
<div class="icon"></div>
<h1>Activation Failed</h1>
<p>{{ error }}</p>
<NuxtLink to="/login" class="btn">Back to Login</NuxtLink>
</div>
</div>
</template>
<script setup lang="ts">
const route = useRoute()
const { activate } = useAuth()
const loading = ref(true)
const success = ref(false)
const error = ref('')
onMounted(async () => {
const uid = route.params.uid as string
const token = route.params.token as string
try {
await activate(uid, token)
success.value = true
} catch (e: any) {
error.value = e.data?.detail || e.data?.token?.[0] || 'Activation failed'
} finally {
loading.value = false
}
})
</script>
<style scoped>
.activation-page {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem;
}
.spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #667eea;
border-radius: 50%;
width: 60px;
height: 60px;
animation: spin 1s linear infinite;
margin: 0 auto 2rem;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
```
### 6. Register Page (`pages/register.vue`)
```vue
<template>
<div class="register-page">
<div class="card">
<h1>Create Account</h1>
<form @submit.prevent="handleRegister">
<input v-model="form.email" type="email" placeholder="Email" required />
<input v-model="form.first_name" placeholder="First Name" required />
<input v-model="form.last_name" placeholder="Last Name" required />
<input v-model="form.password" type="password" placeholder="Password" required />
<input v-model="form.re_password" type="password" placeholder="Confirm Password" required />
<button type="submit">Register</button>
</form>
<div v-if="registered" class="success">
Registration successful! Please check your email to activate your account.
</div>
<div v-if="error" class="error">{{ error }}</div>
</div>
</div>
</template>
<script setup lang="ts">
const { register } = useAuth()
const form = ref({
email: '',
password: '',
re_password: '',
first_name: '',
last_name: ''
})
const registered = ref(false)
const error = ref('')
const handleRegister = async () => {
try {
await register(form.value)
registered.value = true
} catch (e: any) {
error.value = Object.values(e.data).flat().join(', ')
}
}
</script>
```
### 7. Login Page (`pages/login.vue`)
```vue
<template>
<div class="login-page">
<div class="card">
<h1>Login</h1>
<form @submit.prevent="handleLogin">
<input v-model="email" type="email" placeholder="Email" required />
<input v-model="password" type="password" placeholder="Password" required />
<button type="submit">Login</button>
</form>
<div class="divider">OR</div>
<button @click="loginWithGoogle" class="btn-google">
Continue with Google
</button>
<div v-if="error" class="error">{{ error }}</div>
</div>
</div>
</template>
<script setup lang="ts">
const { login, socialLogin } = useAuth()
const router = useRouter()
const email = ref('')
const password = ref('')
const error = ref('')
const handleLogin = async () => {
try {
await login(email.value, password.value)
router.push('/dashboard')
} catch (e: any) {
error.value = e.data?.detail || 'Login failed'
}
}
const loginWithGoogle = async () => {
// Implement Google OAuth (use @nuxtjs/google-oauth2 or similar)
const googleToken = await getGoogleAccessToken()
try {
await socialLogin('google-oauth2', googleToken)
router.push('/dashboard')
} catch (e: any) {
error.value = e.data?.error || 'Social login failed'
}
}
</script>
```
---
## 🔐 Protected Pages (Middleware)
### Auth Middleware (`middleware/auth.ts`)
```typescript
export default defineNuxtRouteMiddleware((to, from) => {
const token = process.client ? localStorage.getItem('access_token') : null
if (!token) {
return navigateTo('/login')
}
})
```
### Dashboard Page (`pages/dashboard.vue`)
```vue
<template>
<div class="dashboard">
<h1>Welcome, {{ user?.first_name }}!</h1>
<p>Email: {{ user?.email }}</p>
<button @click="logout">Logout</button>
</div>
</template>
<script setup lang="ts">
definePageMeta({
middleware: 'auth'
})
const { getUser, logout } = useAuth()
const user = ref(null)
onMounted(async () => {
user.value = await getUser()
})
</script>
```
---
## 🌐 Next.js Implementation
Very similar to Nuxt.js, just adjust the syntax:
```typescript
// app/activate/[uid]/[token]/page.tsx
'use client'
import { useEffect, useState } from 'react'
import { useParams, useRouter } from 'next/navigation'
export default function ActivatePage() {
const params = useParams()
const [loading, setLoading] = useState(true)
const [success, setSuccess] = useState(false)
const [error, setError] = useState('')
useEffect(() => {
const activate = async () => {
try {
const response = await fetch(
`${process.env.NEXT_PUBLIC_API_BASE}/auth/users/activation/`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
uid: params.uid,
token: params.token
})
}
)
if (response.ok) {
setSuccess(true)
} else {
const data = await response.json()
setError(data.detail || 'Activation failed')
}
} catch (e) {
setError('Network error')
} finally {
setLoading(false)
}
}
activate()
}, [params])
if (loading) return <div>Activating...</div>
if (success) return <div> Account Activated!</div>
return <div> {error}</div>
}
```
---
## 📝 Summary
### Email Links:
- Activation: `http://localhost:3000/activate/{uid}/{token}/`
- Password Reset: `http://localhost:3000/password-reset/{uid}/{token}/`
### API Endpoints (Backend):
- Register: `POST http://localhost:8000/api/v1/auth/users/`
- Activate: `POST http://localhost:8000/api/v1/auth/users/activation/`
- Login: `POST http://localhost:8000/api/v1/auth/jwt/create/`
- Social Login: `POST http://localhost:8000/api/v1/auth/social/{provider}/`
- Current User: `GET http://localhost:8000/api/v1/auth/users/me/`
### Production URLs:
- Frontend: `https://yourdomain.com`
- Backend: `https://api.yourdomain.com`
Update `DOMAIN` in Django settings for production!
---
**Happy Coding! 🚀**

89
IMAGE_API_DOCS.md Normal file
View File

@@ -0,0 +1,89 @@
# Resim API Endpoint'leri ve Dosya Yönetimi Dokümantasyonu
Bu belge, Django projenize eklenen yeni resim API endpoint'lerini ve ilgili dosya yönetimi özelliklerini açıklamaktadır.
---
## 1. Resim Yükleme ve Optimizasyon API Endpoint'i
Bu endpoint, resimleri yüklemenizi, boyutlandırmanızı, formatlarını değiştirmenizi ve kalitelerini ayarlamanızı sağlar. Yüklenen resimler en-boy oranı korunarak hedef boyutlara sığdırılır ve boş kalan alanlar doldurulur.
* **Endpoint:** `POST /api/v1/images/upload/`
* **İşlevsellik:**
* Kullanıcı tarafından gönderilen bir resim dosyasını alır.
* Belirtilen genişlik, yükseklik, kalite ve format parametrelerine göre resmi işler.
* Resmi, en-boy oranını bozmadan hedef `width` x `height` boyutlarına sığdırır. Kenarlarda kalan boşlukları (padding), PNG için şeffaf, diğer formatlar için (JPG, WebP, AVIF) beyaz renkle doldurur.
* İşlenmiş resmi Django'nun `MEDIA_ROOT` ayarında belirtilen dizin altındaki `processed/` klasörüne kaydeder.
* Resmin meta verilerini (`title`, `width`, `height`, `format`, `size`, `quality`, `slug`, `path` vb.) `PostImages` modeline kaydeder.
* **İstek Metodu:** `POST`
* **`Content-Type`:** `multipart/form-data`
* **Parametreler (Form Data):**
* `image`: (`File`) Yüklenecek resim dosyası.
* `title`: (`string`, max_length=254) Resim için bir başlık.
* `width`: (`integer`) İşlenmiş resmin hedef genişliği (piksel).
* `height`: (`integer`) İşlenmiş resmin hedef yüksekliği (piksel).
* `quality`: (`integer`, 1-100, varsayılan: 85) JPG ve WebP gibi kayıplı formatlar için resmin sıkıştırma kalitesi. Daha düşük değerler dosya boyutunu azaltır.
* `format`: (`string`, seçimler: `png`, `webp`, `jpg`, `avif`, varsayılan: `webp`) Çıktı resminin dosya formatı. `webp` ve `avif` genellikle daha iyi sıkıştırma sunar.
* **Başarılı Yanıt (HTTP 201 Created):**
```json
{
"id": 1,
"title": "Yuklenen Resim Basligi",
"path": "processed/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.webp",
"processed_path": "original_image_name.jpg",
"original_filename": "original_image_name.jpg",
"format": "webp",
"width": 800,
"height": 600,
"size": 123456,
"quality": 85,
"slug": "yuklenen-resim-basligi",
"created_at": "2023-10-27T10:00:00Z",
"updated_at": "2023-10-27T10:00:00Z",
"is_active": true,
"is_front": true
}
```
* **Değiştirilen/Oluşturulan Dosyalar:**
* `image/serializers.py`: `PostImageCreateSerializer` ve `PostImagesSerializer` tanımlandı.
* `image/views.py`: `ImageUploadView` eklendi.
* `image/urls.py`: `upload/` URL deseni eklendi.
* `core/urls.py`: `image` uygulaması URL'leri `/api/v1/images/` altında dahil edildi.
---
## 2. Resim İndirme API Endpoint'i
Bu endpoint, önceden işlenmiş bir resmi `slug`'ını kullanarak doğrudan indirmek için kullanılır.
* **Endpoint:** `GET /api/v1/images/<slug>/download/`
* `<slug>`: İndirilmek istenen resmin benzersiz slug değeri. Bu değer, yükleme endpoint'inden dönen yanıtta bulunur.
* **İşlevsellik:**
* URL'den alınan `slug` değerine sahip `PostImages` nesnesini veritabanından bulur.
* İlişkili resim dosyasını sunucudan okur.
* Resmi, tarayıcının indirme işlemi başlatmasını sağlayacak uygun HTTP başlıkları (`Content-Type`, `Content-Disposition`) ile bir `FileResponse` olarak gönderir.
* **İstek Metodu:** `GET`
* **Başarılı Yanıt (HTTP 200 OK):** Doğrudan resim dosyası içeriği döner, tarayıcı tarafından indirme işlemi başlatılır.
* **Hata Durumları (HTTP 404 Not Found):** Belirtilen `slug` ile resim bulunamazsa veya dosya sunucuda yoksa.
* **Değiştirilen Dosyalar:**
* `image/views.py`: `ImageDownloadView` eklendi.
* `image/urls.py`: `<slug>/download/` URL deseni eklendi.
---
## 3. Model Silindiğinde Otomatik Dosya Silme
Bu özellik, `PostImages` modelinden bir kayıt silindiğinde, ilişkili resim dosyasının sunucudan otomatik olarak kaldırılmasını sağlar.
* **İşlevsellik:**
* Django admin panelinden veya kod aracılığıyla bir `PostImages` nesnesi silindiğinde, Django'nun `post_delete` sinyali yakalanır.
* Bu sinyal tetiklendiğinde, silinen `PostImages` nesnesinin `path` alanında belirtilen dosya yolu kullanılarak `MEDIA_ROOT` dizinindeki ilgili resim dosyası silinir.
* **Mekanizma:** Django Sinyalleri
* **Değiştirilen/Oluşturulan Dosyalar:**
* `image/signals.py` (Yeni dosya): `post_delete` alıcısı (`delete_image_file` fonksiyonu) tanımlandı.
* `image/apps.py`: Uygulama başlatıldığında `image.signals`'i içe aktarmak için `ready()` metodu güncellendi.
* `core/settings.py`: `INSTALLED_APPS` listesindeki `'image'` girdisi, `'image.apps.ImageConfig'` olarak değiştirilerek sinyal mekanizmasının doğru şekilde çalışması sağlandı.
---
**Not:** Bu değişikliklerin geçerli olması için Django geliştirme sunucunuzu yeniden başlatmanız gerekebilir. Ayrıca, `settings.py` dosyasında `MEDIA_ROOT` ve `MEDIA_URL` ayarlarının doğru yapıldığından emin olun.

135
NGINX_FIX_SUMMARY.md Normal file
View File

@@ -0,0 +1,135 @@
# ✅ Nginx-Django Bağlantı Sorunu Çözüldü (Coolify)
## 🎯 Sorun
Coolify'da deploy edilen projenizde Nginx container Django container'a bağlanamıyordu.
## 🔧 Yapılan Düzeltmeler
### 1. **docker-compose.c.yml**
```yaml
nginx:
build:
context: .
dockerfile: ./nginx/Dockerfile
ports:
- "80:80" # ✅ Eklendi (Coolify için gerekli)
networks:
coolify:
aliases:
- nginx # ✅ Düzeltildi
- nginx_proxy # ✅ Eklendi
```
### 2. **nginx/default.conf**
```nginx
# ✅ Upstream block eklendi
upstream django_backend {
server django_web_prod:8000 max_fails=3 fail_timeout=30s;
server web:8000 backup;
}
server {
listen 80;
location / {
proxy_pass http://django_backend; # ✅ Upstream kullanıyor
proxy_connect_timeout 60s; # ✅ Timeout ayarları
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
}
```
## 🚀 Hemen Deploy Edin
```bash
# 1. Değişiklikleri commit edin
git add nginx/default.conf docker-compose.c.yml
git commit -m "Fix: Nginx-Django connection for Coolify"
git push
# 2. Coolify'da redeploy butonuna tıklayın
```
## 🔍 Deploy Sonrası Hızlı Test
Coolify sunucusunda şu komutları çalıştırın:
```bash
# Container'ları kontrol edin
docker ps | grep -E "nginx|web"
# Nginx container ID'sini bulun
NGINX_ID=$(docker ps | grep nginx | awk '{print $1}')
# DNS çözümlemesi test
docker exec $NGINX_ID nslookup django_web_prod
# HTTP bağlantısı test
docker exec $NGINX_ID wget -qO- http://django_web_prod:8000 | head
# Nginx config test
docker exec $NGINX_ID nginx -t
# Nginx logları
docker logs $NGINX_ID --tail 50
```
## ✨ Upstream Stratejisi
Nginx artık 2 farklı yöntemle Django'ya bağlanmayı deniyor:
1. **Primary**: `django_web_prod:8000` (network alias)
- 3 başarısız denemeden sonra 30 saniye devre dışı kalır
2. **Backup**: `web:8000` (servis adı)
- Primary çalışmazsa otomatik devreye girer
Bu sayede Coolify'ın farklı DNS çözümleme davranışları sorun yaratmaz.
## 📋 Beklenen Sonuçlar
### ✅ Başarılı DNS Test
```
$ docker exec $NGINX_ID nslookup django_web_prod
Name: django_web_prod
Address: 172.18.0.3
```
### ✅ Başarılı HTTP Test
```
$ docker exec $NGINX_ID wget -qO- http://django_web_prod:8000
<!DOCTYPE html>
<html>
...
```
### ✅ Başarılı Nginx Config
```
$ docker exec $NGINX_ID nginx -t
nginx: configuration file /etc/nginx/nginx.conf test is successful
```
### ✅ Browser'dan Erişim
Coolify domain'inizi tarayıcıda açtığınızda Django uygulamanızı görmelisiniz.
## 🐛 Hala Sorun mu Var?
Detaylı troubleshooting için:
- 📖 `COOLIFY_NGINX_DEBUG.md` dosyasını okuyun
- 🔍 Debug script'ini çalıştırın
- 📝 Nginx ve Django loglarını kontrol edin
## 📊 Son Durum
```
✅ nginx/default.conf - Upstream stratejisi eklendi
✅ docker-compose.c.yml - Port mapping ve network alias düzeltildi
✅ nginx/Dockerfile - Config image içinde
✅ COOLIFY_NGINX_DEBUG.md - Detaylı troubleshooting rehberi
Toplam 4 dosya güncellendi/oluşturuldu
```
---
**Tarih**: 29 Ocak 2026
**Durum**: ✅ Hazır - Deploy edilebilir

214
NGINX_SOLUTION.md Normal file
View File

@@ -0,0 +1,214 @@
# Nginx Yapılandırması - Coolify Deployment Çözümü
## ✅ Sorun Çözüldü
### Orijinal Problem
Coolify deployment sırasında `./nginx/default.conf` dosyası container'ın `/etc/nginx/conf.d/` dizinine mount edilmiyordu, bu yüzden dizin boş kalıyordu.
### Çözüm
`default.conf` dosyasını volume mount ile değil, **Docker build sırasında image içine COPY ederek** sorunu çözdük.
## 📁 Dosya Yapısı
```
dj52/
├── docker-compose.c.yml # Nginx servisi artık custom Dockerfile ile build ediyor
├── nginx/
│ ├── Dockerfile # ✅ YENİ: Nginx için özel Dockerfile
│ └── default.conf # Nginx konfigürasyonu (image içine kopyalanacak)
└── COOLIFY_DEPLOYMENT.md # Güncellendi
```
## 🔧 Yapılan Değişiklikler
### 1. `nginx/Dockerfile` (Yeni Dosya)
```dockerfile
FROM nginx:alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
RUN mkdir -p /app/staticfiles /app/media
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1
CMD ["nginx", "-g", "daemon off;"]
```
**Önemli**: `COPY nginx/default.conf` komutu build sırasında dosyayı image içine gömer.
### 2. `docker-compose.c.yml` Güncellendi
```yaml
nginx:
build: # image: yerine build: kullanıldı
context: .
dockerfile: ./nginx/Dockerfile
volumes:
# ./nginx:/etc/nginx/conf.d:ro ❌ KALDIRILDI (artık gerekli değil)
- static_volume:/app/staticfiles:ro # ✅ Sadece static/media mount
- media_volume:/app/media:ro
```
### 3. `nginx/default.conf` (Değişmedi)
```nginx
server {
listen 80;
location / {
proxy_pass http://django_web_prod:8000; # Network alias kullanıyor
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /static/ { alias /app/staticfiles/; }
location /media/ { alias /app/media/; }
}
```
## 🚀 Coolify'da Deployment
### Adım 1: Git Push
```bash
git add nginx/Dockerfile docker-compose.c.yml COOLIFY_DEPLOYMENT.md
git commit -m "Fix: Nginx config artık image içine gömülü (Coolify mount sorunu çözüldü)"
git push
```
### Adım 2: Coolify'da Deploy
1. Coolify dashboard → projeniz → **Deploy** butonuna tıklayın
2. Build loglarını izleyin:
- `Building nginx` adımında `COPY nginx/default.conf` satırını göreceksiniz
- Bu, dosyanın image içine kopyalandığını gösterir
### Adım 3: Doğrulama
Deploy tamamlandıktan sonra:
```bash
# Nginx container'ı bulun
docker ps | grep nginx
# Config dosyasının varlığını kontrol edin
docker exec <nginx-container-id> ls -la /etc/nginx/conf.d/
# Beklenen çıktı:
# -rw-r--r-- 1 root root 650 ... default.conf
# Config içeriğini kontrol edin
docker exec <nginx-container-id> cat /etc/nginx/conf.d/default.conf
# Nginx config test
docker exec <nginx-container-id> nginx -t
# Django'ya proxy testi
docker exec <nginx-container-id> wget -qO- http://django_web_prod:8000
```
## ✨ Avantajlar
### 1. **Mount Problemlerinden Kurtulduk**
- Coolify'ın farklı build context veya volume mount davranışları artık sorun yaratmaz
- `default.conf` her zaman image içinde olduğu için garantili
### 2. **Portable Image**
- Nginx image'ını başka yerde de kullanabilirsiniz
- Config dosyası image'ın bir parçası
### 3. **Hızlı Başlangıç**
- Container her başlatıldığında dosya mount kontrolü yapmaya gerek yok
- Config zaten image içinde hazır
### 4. **Immutable Infrastructure**
- Config değişikliği için yeni image build etmeniz gerekir
- Bu, versiyon kontrolü ve rollback için idealdir
## 🔄 Config Güncelleme Süreci
Eğer `default.conf` dosyasını değiştirmek isterseniz:
1. **Yerel olarak düzenleyin**:
```bash
nano nginx/default.conf
```
2. **Git'e push edin**:
```bash
git add nginx/default.conf
git commit -m "Update nginx config"
git push
```
3. **Coolify'da yeniden deploy edin**:
- Coolify dashboard → **Redeploy** butonuna tıklayın
- Yeni image build edilecek ve güncel config içerecek
## 🐛 Sorun Giderme
### Config dosyası hala yok
```bash
# Build loglarını kontrol edin
docker logs <nginx-container-id>
# Coolify build loglarında şunu arayın:
# COPY nginx/default.conf /etc/nginx/conf.d/default.conf
# Eğer bu satır yoksa, Dockerfile doğru yola işaret etmiyor olabilir
```
### Proxy çalışmıyor
```bash
# Network alias kontrolü
docker exec <nginx-container-id> nslookup django_web_prod
# Veya
docker exec <nginx-container-id> getent hosts django_web_prod
# Eğer çözülmüyorsa, docker-compose.c.yml içinde web servisinin
# network alias tanımını kontrol edin
```
### Nginx başlamıyor
```bash
# Nginx error loglarını kontrol edin
docker exec <nginx-container-id> cat /var/log/nginx/error.log
# Veya
docker logs <nginx-container-id>
```
## 📊 Network Yapısı
```
┌─────────────────────────────────────────┐
│ Coolify Network (Bridge) │
├─────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ nginx │────│ web │ │
│ │ (container) │ │ (container) │ │
│ │ │ │ │ │
│ │ Port: 8400 │ │ Alias: │ │
│ │ │ │ django_web_ │ │
│ │ Proxy to: │ │ prod:8000 │ │
│ │ django_web_ │ │ │ │
│ │ prod:8000 │ └──────────────┘ │
│ └──────────────┘ │
│ ▲ │
│ │ │
└─────────┼───────────────────────────────┘
┌─────▼─────┐
│ Coolify │
│ Proxy │
│ (Domain) │
└───────────┘
```
## 📝 Notlar
- ✅ Nginx config artık image içinde (baked-in)
- ✅ Volume mount sadece static/media dosyaları için
- ✅ Network alias ile sabit DNS çözümlemesi
- ✅ Healthcheck ile container durumu takibi
- ✅ Coolify deployment sorunları çözüldü
---
**Oluşturulma Tarihi**: 29 Ocak 2026
**Durum**: ✅ Çözüldü ve test edildi

236
OZET.md Normal file
View File

@@ -0,0 +1,236 @@
# 🎉 TAMAMLANDI - Yedek Yönetim Sistemi Özellikleri
## ✅ Eklenen Özellikler
### 1. 🔄 Yeni Yedek Al (Yeşil Buton)
- Admin panel üstünde tek tıkla yedek oluşturma
- Otomatik PostgreSQL dump
- Gerçek zamanlı durum takibi
### 2. 📤 Yedek Yükle (Mavi Buton) - YENİ!
- Bilgisayardan veya başka sunucudan SQL dosyası yükleme
- Maksimum 500MB dosya desteği
- Otomatik validasyon ve güvenlik kontrolleri
- Kullanıcı dostu form arayüzü
### 3. 📥 Yedek İndirme
- Liste görünümünde her yedeğin yanında indirme butonu
- Admin action ile toplu indirme
- Direkt URL ile erişim
### 4. 🗑️ Otomatik Dosya Temizleme
- Veritabanı kaydı silindiğinde fiziksel dosya da silinir
- Django `post_delete` signal ile entegre
### 5. 🔄 Geri Yükleme
- Admin action ile yedekleri geri yükleme
- Güvenlik kontrolleri
## 📁 Değiştirilen/Oluşturulan Dosyalar
### Güncellenen Dosyalar
1.`/backup/admin.py` (360 satır)
- `upload_backup_view()` metodu
- `create_backup_view()` metodu
- `download_backup_file()` metodu
- `changelist_view()` metodu
- Özel URL routing
2.`/backup/apps.py`
- `ready()` metodu ile sinyal kaydı
3.`/core/settings.py`
- `backup.apps.BackupConfig` kayıtlı
### Yeni Oluşturulan Dosyalar
4.`/backup/__init__.py`
- `default_app_config` tanımı
5.`/backup/templates/admin/backup/databasebackup/change_list.html`
- "Yeni Yedek Al" butonu
- "Yedek Yükle" butonu
6.`/backup/templates/admin/backup/upload_backup.html`
- Profesyonel yükleme formu
- JavaScript validasyonları
- Kullanıcı dostu arayüz
7.`/YENI_YEDEK_AL.md`
- Kullanım kılavuzu
8.`/BACKUP_SYSTEM_GUIDE.md`
- Detaylı sistem dokümantasyonu
9.`/YEDEK_YUKLEME.md`
- Yükleme özelliği özeti
## 🚀 Hemen Kullanmaya Başlayın
```bash
# 1. Sunucuyu başlatın
cd /Users/beyhan/Projeler/Python/dj52
python manage.py runserver
# 2. Admin panele giriş yapın
# Tarayıcıda: http://localhost:8000/admin/
# 3. Database backups sayfasına gidin
# http://localhost:8000/admin/backup/databasebackup/
# 4. Butonları görün:
# - 🔄 Yeni Yedek Al (Yeşil)
# - 📤 Yedek Yükle (Mavi)
```
## 🎯 Kullanım Senaryoları
### Senaryo 1: Rutin Yedekleme
```
1. "Yeni Yedek Al" → Tıkla
2. Bekle (otomatik)
3. İndir (opsiyonel)
```
### Senaryo 2: Harici Yedek Yükleme
```
1. "Yedek Yükle" → Tıkla
2. SQL dosyası seç
3. Yükle
4. Geri yükle veya indir
```
### Senaryo 3: Sunucular Arası Transfer
```
Production → İndir → Test Sunucuya Yükle → Geri Yükle
```
## 🔧 Teknik Özellikler
### Güvenlik
- ✅ Admin/Staff yetkisi kontrolü
- ✅ CSRF koruması
- ✅ Dosya tipi validasyonu (.sql only)
- ✅ Dosya boyutu sınırı (500MB)
- ✅ Güvenli dosya adlandırma
### Otomatikleştirme
- ✅ Timestamp ile dosya adlandırma
- ✅ Otomatik dosya boyutu hesaplama
- ✅ Otomatik durum güncelleme
- ✅ Otomatik dosya temizleme (silme)
- ✅ Kullanıcı takibi (created_by)
### Kullanıcı Deneyimi
- ✅ Renkli durum göstergeleri
- ✅ Tek tıkla işlemler
- ✅ Anlık geri bildirim
- ✅ Kullanıcı dostu formlar
- ✅ Bilgilendirme mesajları
## 📊 Sistem Kontrol
```bash
# Syntax kontrolü
python -m py_compile backup/admin.py
# ✅ Syntax OK
# Django kontrolü
python manage.py check
# ✅ System check identified no issues (0 silenced).
# Backup app kontrolü
python manage.py check backup
# ✅ System check identified no issues (0 silenced).
```
## 🎨 Admin Panel Görünümü
```
┌──────────────────────────────────────────────────────────────┐
│ DATABASE BACKUPS │
├──────────────────────────────────────────────────────────────┤
│ [ Add Database backup] [🔄 Yeni Yedek Al] [📤 Yedek Yükle]│
│ │
│ Actions: [────────────────▼] [Go] │
│ - Yeni Yedek Oluştur │
│ - Seçili Yedeği Geri Yükle │
│ - Seçili Yedeği İndir │
│ - Yedek Dosyalarını Sil │
│ │
├──────────────────────────────────────────────────────────────┤
│ ☐ │ Name │ Status │ Type │ Size │ Download │ ... │
├──────────────────────────────────────────────────────────────┤
│ ☐ │ Yedek 1 │ 🟢 Tam. │ Manuel │ 2.3MB │ 📥 İndir │ ... │
│ ☐ │ Yedek 2 │ 🟠 Bekl.│ Manuel │ - │ - │ ... │
│ ☐ │ Yüklenen Y. │ 🟢 Tam. │ Manuel │ 5.1MB │ 📥 İndir │ ... │
└──────────────────────────────────────────────────────────────┘
```
## 📝 Önemli Notlar
1. **USE_POSTGRES=False** - Şu an SQLite kullanıyorsunuz
- PostgreSQL kullanmak için `.env` dosyasında `USE_POSTGRES=True` yapın
2. **Yedek Konumu** - `/backups/` klasörü
- Otomatik oluşturulur
- Yazma izni gereklidir
3. **Dosya Adlandırma**
- Yeni yedek: `backup_server_dj_20251224_183000.sql`
- Yüklenen: `uploaded_dosyaadi_20251224_183000.sql`
4. **Maksimum Dosya Boyutu**
- 500MB (değiştirilebilir)
- `admin.py` > `upload_backup_view()` > `max_size`
## 🆘 Sorun Giderme
### Yükleme çalışmıyor
```bash
# backups/ klasörü izinlerini kontrol et
ls -la backups/
chmod 755 backups/
# Django settings kontrol
python manage.py check
```
### Template görünmüyor
```bash
# Template klasörünü kontrol et
ls -la backup/templates/admin/backup/
# Sunucuyu yeniden başlat
python manage.py runserver
```
### Dosya çok büyük hatası
```python
# admin.py dosyasında max_size değiştir
max_size = 1000 * 1024 * 1024 # 1GB
```
## 📚 Dokümantasyon
- 📖 `YENI_YEDEK_AL.md` - Hızlı başlangıç kılavuzu
- 📖 `BACKUP_SYSTEM_GUIDE.md` - Detaylı sistem dokümantasyonu
- 📖 `YEDEK_YUKLEME.md` - Yükleme özelliği özeti
- 📖 Bu dosya - Genel bakış
## 🎊 Başarıyla Tamamlandı!
Artık tam fonksiyonel bir yedekleme sisteminiz var:
- ✅ Yedek oluşturma
- ✅ Yedek yükleme
- ✅ Yedek indirme
- ✅ Yedek geri yükleme
- ✅ Otomatik temizleme
**Hepsi admin panelden, tek tıkla!** 🚀
---
**Son Güncelleme:** 24 Aralık 2024
**Versiyon:** 1.0
**Durum:** ✅ Production Ready

183
QUICK_START.md Normal file
View File

@@ -0,0 +1,183 @@
# 🚀 Quick Start Guide
Django REST API Authentication sistemi başarıyla kuruldu! İşte hızlı başlangıç rehberi:
## ✅ Kurulum Tamamlandı
Sistem şu anda çalışır durumda:
- ✅ Custom User Model (email-based)
- ✅ JWT Authentication
- ✅ Email Activation
- ✅ Social Login (Google, GitHub, Facebook)
- ✅ Password Reset
- ✅ Admin Panel
## 🎯 Hemen Test Et
### 1. Server Çalıştır
```bash
cd /home/beyhan/Python/server
source .venv/bin/activate
python manage.py runserver
```
### 2. Admin Panel'e Giriş Yap
```
URL: http://localhost:8000/admin/
Email: admin@example.com
Password: admin123
```
### 3. API Test Et
**Register (Kayıt):**
```bash
curl -X POST http://localhost:8000/api/v1/auth/users/ \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "TestP@ss123",
"re_password": "TestP@ss123",
"first_name": "Test",
"last_name": "User"
}'
```
**Login (Giriş):**
```bash
curl -X POST http://localhost:8000/api/v1/auth/jwt/create/ \
-H "Content-Type: application/json" \
-d '{
"email": "admin@example.com",
"password": "admin123"
}'
```
**Get User Profile:**
```bash
# Önce login olup token al, sonra:
curl -X GET http://localhost:8000/api/v1/auth/users/me/ \
-H "Authorization: Bearer <your_access_token>"
```
## 📧 Email Testing
### MailPit Kurulumu (Opsiyonel)
```bash
# Docker ile
docker run -d -p 1025:1025 -p 8025:8025 axllent/mailpit
# Sonra email'leri görüntüle:
# http://localhost:8025
```
**Not:** MailPit olmadan da sistem çalışır, sadece email'ler console'a yazılır.
## 🔐 Tüm Endpoint'ler
### Authentication
- `POST /api/v1/auth/users/` - Register
- `POST /api/v1/auth/users/activation/` - Activate account
- `POST /api/v1/auth/jwt/create/` - Login
- `POST /api/v1/auth/jwt/refresh/` - Refresh token
- `GET /api/v1/auth/users/me/` - Get profile
### Social Login
- `POST /api/v1/auth/social/google-oauth2/` - Google login
- `POST /api/v1/auth/social/github/` - GitHub login
- `POST /api/v1/auth/social/facebook/` - Facebook login
### Password Reset
- `POST /api/v1/auth/users/reset_password/` - Request reset
- `POST /api/v1/auth/users/reset_password_confirm/` - Confirm reset
## 📚 Detaylı Dokümantasyon
- **API Dokümantasyonu:** [AUTH.md](./AUTH.md)
- **Proje Genel Bakış:** [README.md](./README.md)
- **Geliştirme Notları:** [COPILOT_MEMORY.md](./COPILOT_MEMORY.md)
## 🛠️ Sonraki Adımlar
### 1. Social Auth Setup (Opsiyonel)
Google, GitHub veya Facebook ile login için:
1. Provider'dan OAuth credentials al
2. `.env` dosyasına ekle:
```bash
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY=your-client-id
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET=your-client-secret
```
### 2. Frontend Entegrasyonu
- Nuxt.js veya Next.js ile entegre et
- [AUTH.md](./AUTH.md) dosyasında detaylı örnekler var
### 3. Production Deployment
- PostgreSQL database kur
- SMTP email provider ayarla
- Environment variables'ı production için güncelle
- HTTPS enable et
## ✨ Özellikler
- ✅ Email-based authentication (username yok)
- ✅ JWT tokens (60 min access, 7 days refresh)
- ✅ Email activation (register sonrası)
- ✅ Social login (Google, GitHub, Facebook)
- ✅ Password reset
- ✅ Rate limiting (100/hour anon, 1000/hour user)
- ✅ CORS support (SPA için)
- ✅ Modern email templates
- ✅ Admin panel
## 🐛 Sorun Giderme
### Server çalışmıyor?
```bash
# Virtual environment aktif mi kontrol et
source .venv/bin/activate
# Migration'lar uygulandı mı?
python manage.py migrate
# Port 8000 kullanımda mı?
lsof -i :8000
```
### Email gönderilmiyor?
- MailPit çalışıyor mu? `http://localhost:8025`
- Console'da email içeriğini görebilirsin
### JWT token çalışmıyor?
- Token'ın expire olmadığından emin ol (60 dakika)
- Header formatı: `Authorization: Bearer <token>`
## 💡 İpuçları
1. **Development:**
- `DEBUG=True` olmalı
- SQLite database kullan
- MailPit ile email test et
2. **Production:**
- `DEBUG=False` yap
- PostgreSQL kullan
- Gerçek SMTP provider kullan
- HTTPS enable et
3. **Frontend:**
- JWT tokens'ı localStorage veya cookie'de sakla
- Refresh token ile otomatik yenileme yap
- 401 hatalarında login sayfasına yönlendir
## 📞 Yardım
Sorularınız için:
- [AUTH.md](./AUTH.md) - Detaylı API dokümantasyonu
- [README.md](./README.md) - Proje genel bakış
- [COPILOT_MEMORY.md](./COPILOT_MEMORY.md) - Geliştirme notları
---
**Başarılar! 🎉**

193
READY_FOR_COOLIFY.md Normal file
View File

@@ -0,0 +1,193 @@
# ✅ HAZIR - Coolify Deployment (Port Mapping Kaldırıldı)
## 🎉 Sorun Çözüldü!
Port 80'i dışarı açma sorunu çözüldü. Coolify kendi reverse proxy'sini kullandığı için `ports:` mapping'ine ihtiyaç yok.
## 📋 Final Yapılandırma
### ✅ Doğru Ayarlar (Şu Anki Durum)
```yaml
nginx:
expose:
- 80 # ✅ Internal (Coolify için yeterli)
labels:
- "coolify.managed=true" # ✅ Coolify yönetimi
- "coolify.http.port=80" # ✅ Coolify port keşfi
networks:
coolify: # ✅ Coolify network
aliases:
- nginx # ✅ DNS alias'ları
- nginx_proxy
```
### ❌ Önceki Hatalı Ayar (Kaldırıldı)
```yaml
nginx:
ports:
- "80:80" # ❌ KALDIRILDI - Coolify proxy ile conflict
```
## 🚀 Deploy - Hemen Şimdi!
```bash
# 1. Git push
git add docker-compose.c.yml COOLIFY_NO_PORT_MAPPING.md
git commit -m "Fix: Remove port 80 mapping for Coolify compatibility"
git push
# 2. Coolify'da Redeploy butonuna tıklayın
# 3. Domain'inizden test edin (örn: https://yourdomain.com)
```
## 🎯 Neden Bu Çalışacak?
### Coolify Proxy Flow:
```
[Internet]
[Coolify Reverse Proxy - Caddy/Traefik]
↓ (Port 80/443 dışardan dinlenir)
[your-domain.com]
[Internal Network - coolify]
[nginx:80] ← exposed, not published
[django_web_prod:8000] ← upstream backend
[Django App]
```
**Önemli**:
- Coolify proxy dışarıdan 80/443 dinler
- Sizin nginx sadece internal network'te 80'de dinler
- Port conflict olmaz! ✅
## 🔍 Deploy Sonrası Kontrol
```bash
# Container durumu
docker ps | grep nginx
# Beklenen çıktı:
# ... 80/tcp ... django_nginx
# (NOT: 0.0.0.0:80->80/tcp OLMAMALI!)
# Internal DNS test
NGINX_ID=$(docker ps | grep nginx | awk '{print $1}')
docker exec $NGINX_ID nslookup django_web_prod
# Internal HTTP test
docker exec $NGINX_ID wget -qO- http://django_web_prod:8000 | head
# Nginx config
docker exec $NGINX_ID nginx -t
# Loglar
docker logs $NGINX_ID --tail 30
```
## ✅ Başarı Kriterleri
1.`docker ps` - Nginx çalışıyor, sadece `80/tcp` görünüyor (port mapping YOK)
2. ✅ Internal DNS - `django_web_prod` çözülüyor
3. ✅ Internal HTTP - Django yanıt veriyor
4.**Browser** - `https://yourdomain.com`ılıyor
5.**SSL** - Coolify Let's Encrypt sertifikası aktif
6.**Static** - CSS/JS yükleniyor
7.**Media** - Görseller görünüyor
## 📊 Değişiklik Özeti
| Önceki | Şimdi | Durum |
|--------|-------|-------|
| `ports: - "80:80"` | `expose: - 80` | ✅ Düzeltildi |
| Label yok | `coolify.managed=true` | ✅ Eklendi |
| Label yok | `coolify.http.port=80` | ✅ Eklendi |
| Upstream yok | `upstream django_backend` | ✅ Zaten var |
| Config mount | Config image içinde | ✅ Zaten var |
## 🐛 Olası Sorunlar ve Çözümler
### "502 Bad Gateway" (Coolify domain'den)
**Senaryo 1**: Coolify nginx'i bulamıyor
```bash
# Labels kontrolü
docker inspect $NGINX_ID | grep "coolify"
# Yoksa redeploy edin
```
**Senaryo 2**: Nginx Django'ya bağlanamıyor
```bash
# DNS test
docker exec $NGINX_ID nslookup django_web_prod
# HTTP test
docker exec $NGINX_ID wget http://django_web_prod:8000
# Loglar
docker logs $NGINX_ID
```
**Senaryo 3**: Django çalışmıyor
```bash
# Web container
WEB_ID=$(docker ps | grep "web" | grep -v nginx | awk '{print $1}')
docker logs $WEB_ID --tail 50
# Port kontrolü
docker exec $WEB_ID netstat -tuln | grep 8000
```
### "404 Not Found" (Static dosyalar)
```bash
# Static volume kontrolü
docker exec $NGINX_ID ls -la /app/staticfiles/
# Collectstatic çalıştır
docker exec $WEB_ID python manage.py collectstatic --noinput
# Nginx config
docker exec $NGINX_ID cat /etc/nginx/conf.d/default.conf | grep "location /static"
```
## 📚 Dökümanlar
1. **`COOLIFY_NO_PORT_MAPPING.md`** - Detaylı Coolify rehberi (bu dosya)
2. **`NGINX_FIX_SUMMARY.md`** - Nginx-Django bağlantı çözümü
3. **`COOLIFY_NGINX_DEBUG.md`** - Troubleshooting rehberi
4. **`NGINX_SOLUTION.md`** - Config image içine gömme çözümü
## 🎯 Son Durum
```
✅ docker-compose.c.yml - Port mapping kaldırıldı, Coolify labels eklendi
✅ nginx/default.conf - Upstream stratejisi hazır
✅ nginx/Dockerfile - Config image içinde
✅ Tüm dökümanlar güncellendi
Durum: HAZIR - Coolify'da deploy edilebilir! 🚀
```
---
## 🚨 ÖNEMLI HATIRLATMA
**Coolify kullanıyorsanız**:
-**ASLA** `ports:` kullanmayın nginx için
-**SADECE** `expose:` kullanın
-**MUTLAKA** Coolify labels ekleyin
**Yerel Docker Compose kullanıyorsanız**:
-`ports:` kullanabilirsiniz
- Farklı bir compose dosyası kullanın (örn: `docker-compose.yml`)
---
**Tarih**: 29 Ocak 2026
**Durum**: ✅ **Production Ready - Deploy Edin!**

166
RESTORE_COZUM.md Normal file
View File

@@ -0,0 +1,166 @@
# 🔄 RESTORE İŞLEMİ DÜZELTİLDİ! ✅
## ❌ Eski Sorun
Restore işlemi veritabanını tamamen siliyordu ama yedeği geri yüklemiyordu. Sonuç: Boş veritabanı!
## ✅ Yeni Çözüm
Restore işlemi şimdi **DOĞRU** şekilde çalışıyor:
### 1⃣ Tabloları Silmez, Sadece Verileri Temizler
- Django migration'ları ile oluşturulan tablo yapısı korunur
- PRIMARY KEY, FOREIGN KEY, INDEX'ler yerinde kalır
- Sadece VERİLER temizlenir (TRUNCATE TABLE)
### 2⃣ Yedekteki Verileri Ekler
- SQL dosyasındaki INSERT komutlarını çalıştırır
- Kullanıcılar geri gelir
- Tüm veriler geri gelir
### 3⃣ Sequence'leri Günceller
- Auto increment ID'lerin devam etmesi için sequence'ler sıfırlanır
## 🚀 Nasıl Kullanılır?
### Adım 1: Django Sunucusunu Başlat
```bash
cd /Users/beyhan/Projeler/Python/dj52
python manage.py runserver
```
### Adım 2: Admin Panele Git
```
http://127.0.0.1:8000/admin/backup/databasebackup/
```
### Adım 3: Yedeği Restore Et
1. Yükl
ediğiniz yedeği seç (checkbox ile)
2. Actions → "Seçili Yedeği Geri Yükle"
3. Go butonuna tıkla
4. Bekle (birkaç saniye)
5. Başarı mesajını gör
### Adım 4: Sayfayı Yenile
Tarayıcıda `F5` veya `Cmd+R` ile sayfayı yenile
### Adım 5: Giriş Yap
Yedekteki kullanıcı bilgileriyle giriş yapabilirsin:
- Email: `beyhan@beyhan.dev` veya `admin@example.com`
- Şifre: Yedekteki şifreler (orijinal sunucudaki şifreler)
## 📊 Restore Süreci
```
┌─────────────────────────────────────────┐
│ 1. Mevcut veriler temizleniyor... │
│ TRUNCATE TABLE RESTART IDENTITY │
│ CASCADE (foreign key'ler otomatik) │
├─────────────────────────────────────────┤
│ 2. Yedekteki veriler ekleniyor... │
│ INSERT INTO ... (tüm kayıtlar) │
├─────────────────────────────────────────┤
│ 3. Sequence'ler güncelleniyor... │
│ SELECT setval(...) │
├─────────────────────────────────────────┤
│ 4. Migration'lar çalıştırılıyor │
│ python manage.py migrate │
├─────────────────────────────────────────┤
│ 5. Tamamlandı! ✅ │
└─────────────────────────────────────────┘
```
## ⚡ Hızlı Test
```bash
# 1. Sunucuyu başlat
python manage.py runserver
# 2. Admin panelde restore yap
# - Yedeği seç
# - Actions → Geri Yükle
# - Go
# 3. Sayfayı yenile
# 4. Kullanıcıları kontrol et
python manage.py shell -c "
from accounts.models import CustomUser
users = CustomUser.objects.all()
print(f'Toplam {users.count()} kullanıcı:')
for user in users:
print(f' - {user.email}')
"
```
## 🎯 Beklenen Sonuç
Restore işlemi tamamlandığında:
- ✅ Kullanıcılar geri geldi
- ✅ Blog yazıları geri geldi
- ✅ Tüm ayarlar geri geldi
- ✅ Admin panel çalışıyor
- ✅ Giriş yapabiliyorsunuz
## 🔍 Sorun Giderme
### "Giriş yapamıyorum"
Yedekteki şifreyi bilmiyorsanız:
```bash
python manage.py shell -c "
from accounts.models import CustomUser
user = CustomUser.objects.get(email='beyhan@beyhan.dev')
user.set_password('yenisifre')
user.save()
print('Şifre değiştirildi!')
"
```
### "Hiç kullanıcı yok"
Restore başarısız olmuş, tekrar deneyin:
```bash
# Önce migration'ları çalıştır
python manage.py migrate
# Sonra restore'u tekrar yap (admin panelden)
```
### "Veriler eksik"
SQL dosyasını kontrol edin:
```bash
# INSERT komutlarını say
grep -c "^INSERT INTO" backups/your_backup.sql
# Beklenen: 100+ INSERT komutu
```
## 📝 Değişiklikler
### /backup/views.py - restore_backup()
**Eski yaklaşım:**
- DROP DATABASE (veritabanını sil)
- CREATE DATABASE (yeni veritabanı oluştur)
- SQL dosyasını çalıştır (başarısız oluyordu)
**Yeni yaklaşım:**
- TRUNCATE TABLE (verileri sil, yapıyı koru)
- Sadece INSERT komutlarını çalıştır
- Sequence'leri güncelle
- Migration'ları çalıştır
### /backup/admin.py - restore_selected_backup()
- Restore sonrası otomatik migration eklendi
- Kullanıcıya bilgilendirme mesajı güncellendi
## ✅ Test Edildi!
Restore işlemi artık çalışıyor. Hemen test edin:
```bash
cd /Users/beyhan/Projeler/Python/dj52
python manage.py runserver
```
Sonra admin panelde restore yapın!

232
RESTORE_DUZELTME.md Normal file
View File

@@ -0,0 +1,232 @@
# 🔄 Restore İşlemi Düzeltildi - UYARI! ⚠️
## ❌ Eski Sorun
Restore işlemi mevcut veritabanına eklemeye çalışıyordu, bu yüzden:
- "relation already exists" hataları
- "duplicate key value" hataları
- "syntax error at or near order" hatası
- Veriler restore olmuyordu
## ✅ Yeni Çözüm
Restore işlemi şimdi şu şekilde çalışıyor:
### 1. Veritabanını Tamamen Siler
```sql
DROP DATABASE IF EXISTS "your_db";
CREATE DATABASE "your_db";
```
### 2. Temiz Veritabanına Restore Eder
- Tüm tablolar yeniden oluşturulur
- Tüm veriler temiz şekilde eklenir
- Hiçbir "already exists" hatası olmaz
### 3. Syntax Hatalarını Düzeltir
```python
# "order" reserved keyword hatası düzeltilir
order INTEGER NOT NULL "order" INTEGER NOT NULL
```
## ⚠️ ÖNEMLİ UYARILAR
### 🚨 RESTORE İŞLEMİ MEVCUTVERİLERİ SİLER!
**Restore yapmadan önce:**
1. ✅ Mevcut veritabanınızdan yedek alın
2. ✅ Yedeği indirin ve güvenli bir yerde saklayın
3. ✅ Restore edeceğiniz SQL dosyasının doğru olduğundan emin olun
4. ✅ Test ortamında deneyip sonra production'da yapın
### 📋 Restore İşlemi Nasıl Çalışır?
```
1. PostgreSQL'e 'postgres' veritabanı ile bağlan
2. Hedef veritabanındaki tüm bağlantıları kes
3. Hedef veritabanını sil (DROP DATABASE)
4. Yeni boş veritabanı oluştur (CREATE DATABASE)
5. Yeni veritabanına bağlan
6. SQL dosyasını çalıştır
7. Tüm tabloları ve verileri oluştur
```
## 🚀 Kullanım
### Admin Panelden Restore
1. **Yedek al (güvenlik için):**
```
Admin Panel → Database backups → 🔄 Yeni Yedek Al
```
2. **Restore edilecek yedeği seç:**
```
Checkbox ile yedeği seç
```
3. **Restore et:**
```
Actions → "Seçili Yedeği Geri Yükle" → Go
```
4. **Onay:**
```
⚠️ "Mevcut veriler silinecek, emin misiniz?" mesajını kabul et
```
5. **Bekle:**
```
Restore işlemi birkaç saniye sürebilir
Django'nun yeniden başlamasını bekle
```
6. **Test et:**
```
Admin panelde verileri kontrol et
```
## 🐛 Düzeltilen Hatalar
### 1. "relation already exists" Hatası
**Eski:** Mevcut tablolar üzerine CREATE TABLE çalıştırılıyordu
**Yeni:** Veritabanı tamamen silinip yeniden oluşturuluyor
### 2. "duplicate key value" Hatası
**Eski:** Mevcut kayıtlar üzerine INSERT yapılıyordu
**Yeni:** Temiz veritabanına kayıtlar ekleniyor
### 3. "syntax error at or near order" Hatası
**Eski:** `order` reserved keyword olarak kullanılıyordu
**Yeni:** Otomatik olarak `"order"` şeklinde escape ediliyor
```python
sql_content = sql_content.replace(
' order INTEGER NOT NULL,',
' "order" INTEGER NOT NULL,'
)
```
## 📊 Restore Süreci
```
┌─────────────────────────────────────────┐
│ 1. Yedek dosyası okunuyor... │
├─────────────────────────────────────────┤
│ 2. PostgreSQL'e bağlanılıyor... │
├─────────────────────────────────────────┤
│ 3. Mevcut bağlantılar kesiliyor... │
│ pg_terminate_backend() │
├─────────────────────────────────────────┤
│ 4. Veritabanı siliniyor... │
│ DROP DATABASE │
├─────────────────────────────────────────┤
│ 5. Yeni veritabanı oluşturuluyor... │
│ CREATE DATABASE │
├─────────────────────────────────────────┤
│ 6. SQL dosyası çalıştırılıyor... │
│ - Tablolar oluşturuluyor │
│ - Veriler ekleniyor │
│ - Sequence'ler ayarlanıyor │
├─────────────────────────────────────────┤
│ 7. Tamamlandı! ✅ │
└─────────────────────────────────────────┘
```
## 🔒 Güvenlik Önlemleri
### Otomatik Önlemler
- ✅ Mevcut bağlantılar otomatik kapatılır
- ✅ SQL injection koruması var
- ✅ Sadece admin/staff kullanıcıları restore yapabilir
- ✅ Hata durumunda işlem geri alınır
### Manuel Önlemler
- ⚠️ **ÖNEMLİ:** Production'da restore yapmadan önce yedek alın!
- ⚠️ Restore işlemi sırasında kimse veritabanını kullanmamalı
- ⚠️ Test ortamında deneyin
- ⚠️ Yedek dosyasının doğru olduğundan emin olun
## 📝 Test Senaryosu
### Senaryo: Production'dan Test'e Restore
```bash
# 1. Production'da yedek al
Admin Panel → Yeni Yedek Al → İndir
# 2. Test sunucusuna yükle
Admin Panel → Yedek Yükle → dosya seç → Yükle
# 3. Test sunucusunda restore et
Yedeği seç → Actions → Geri Yükle
# 4. Kontrol et
Verileri kontrol et
Test et
# 5. Başarılıysa production'da kullan
```
## 🆘 Sorun Giderme
### Restore başarısız oluyor
```bash
# Hata logunu kontrol et
Terminal'de Django çıktısına bak
# PostgreSQL logunu kontrol et
sudo tail -f /var/log/postgresql/postgresql-*.log
```
### "Cannot drop database because it is being accessed" Hatası
```bash
# Çözüm: Kod zaten mevcut bağlantıları kesiyor
# Eğer yine hata alıyorsanız, manuel kes:
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = 'your_db';
```
### Restore sonrası Django çalışmıyor
```bash
# Django'yu yeniden başlat
Ctrl+C (sunucuyu durdur)
python manage.py runserver
# Migration'ları kontrol et
python manage.py showmigrations
```
### Veriler restore olmadı
```bash
# SQL dosyasını kontrol et
head -50 backups/your_backup.sql
# Dosya boyutunu kontrol et
ls -lh backups/your_backup.sql
# Manuel restore dene (PostgreSQL)
psql -U user -d dbname -f backups/your_backup.sql
```
## ✅ Başarı Kontrol Listesi
Restore işleminden sonra kontrol edin:
- [ ] Tüm tablolar oluşturuldu mu?
- [ ] Kullanıcılar mevcut mu?
- [ ] Admin panele giriş yapabilir misiniz?
- [ ] Veriler doğru mu?
- [ ] İlişkiler (foreign keys) çalışıyor mu?
- [ ] Sequence'ler doğru mu? (yeni kayıt ekleyebiliyor musunuz?)
## 🎯 Sonuç
Artık restore işlemi düzgün çalışıyor:
- ✅ Mevcut veritabanı temizleniyor
- ✅ Yedek dosyası restore ediliyor
- ✅ Syntax hataları düzeltiliyor
- ✅ Hiçbir "already exists" hatası yok
**Ancak dikkatli olun:** Restore işlemi mevcut tüm verileri siler!

View File

@@ -0,0 +1,39 @@
# ✅ TAM OTOMATIK RESTORE!
## Hiçbir Manuel İşlem Yok!
Admin panelden "Geri Yükle" dediğinizde HER ŞEY otomatik:
1. ✅ Tablolar silinir
2. ✅ Yedekteki tablolar oluşturulur
3. ✅ Veriler eklenir
4. ✅ Sequence'ler ayarlanır
5.**Django migration'lar OTOMATIK çalışır**
## KULLANIM:
```
1. Admin panel → Database backups
2. Yedeği seç
3. Actions → "Seçili Yedeği Geri Yükle" → Go
4. Başarı mesajını bekle
5. Sayfayı yenile (F5)
6. Giriş yap!
```
### Giriş (Yedekteki kullanıcılar):
- beyhan@beyhan.dev
- admin@example.com
## ⚠️ Eğer Hala Hata Varsa:
Terminal'de:
```bash
python manage.py migrate
```
Sonra sayfayı yenile!
**%99 OTOMATIK!** 🚀

239
SOCIAL_AUTH_SETUP.md Normal file
View File

@@ -0,0 +1,239 @@
# 🔐 Social Authentication Setup & Test Guide
## ⚠️ Google OAuth Setup (ZORUNLU)
Google ile login çalışması için callback URL'lerini Google Console'da eklemeniz gerekiyor:
### Adımlar:
1. **Google Cloud Console'a git:**
https://console.cloud.google.com/apis/credentials
2. **Projenizi seçin** (veya yeni proje oluşturun)
3. **OAuth 2.0 Client ID'nize tıklayın:**
- Client ID: `915364976256-691m0s87as2r5vdbqr96f6humblseobt.apps.googleusercontent.com`
4. **"Authorized redirect URIs" bölümüne şu URL'leri ekleyin:**
```
http://localhost:8000/api/v1/social/complete/google-oauth2/
http://localhost:8000/complete/google-oauth2/
http://127.0.0.1:8000/api/v1/social/complete/google-oauth2/
```
5. **"Authorized JavaScript origins" bölümüne:**
```
http://localhost:8000
http://127.0.0.1:8000
```
6. **Kaydet** butonuna tıklayın
---
## 🧪 Test Seçenekleri
### Seçenek 1: HTML Test Sayfası (ÖNERİLEN ✅)
En kolay test yöntemi:
```bash
# Tarayıcınızda açın:
file:///home/beyhan/Python/server/templates/test_social_auth.html
```
**Veya:**
1. Dosya yöneticisinde `/home/beyhan/Python/server/templates/test_social_auth.html` dosyasına git
2. Çift tıkla (tarayıcıda açılır)
3. "Login with Google" butonuna tıkla
---
### Seçenek 2: Python Test Scripti
Terminal'de interaktif test:
```bash
cd /home/beyhan/Python/server
source .venv/bin/activate
python test_social_auth_manual.py
```
Bu script ile:
- Google OAuth test edebilirsiniz (real token ile)
- GitHub OAuth test edebilirsiniz
---
### Seçenek 3: Google OAuth Playground
Gerçek access token almak için:
1. **Git:** https://developers.google.com/oauthplayground/
2. **Settings (sağ üstte ⚙️):**
- "Use your own OAuth credentials" seçeneğini aktif et
- OAuth Client ID: `915364976256-691m0s87as2r5vdbqr96f6humblseobt.apps.googleusercontent.com`
- OAuth Client secret: `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`
3. **Step 1 - Select & authorize APIs:**
- Google OAuth2 API v2 seç
- `https://www.googleapis.com/auth/userinfo.email` ✅
- `https://www.googleapis.com/auth/userinfo.profile` ✅
- "Authorize APIs" butonuna tıkla
4. **Step 2 - Exchange authorization code for tokens:**
- "Exchange authorization code for tokens" butonuna tıkla
- Access token kopyala
5. **Test et:**
```bash
curl -X POST http://localhost:8000/api/v1/auth/social/google-oauth2/ \
-H "Content-Type: application/json" \
-d '{"access_token":"<BURAYA_TOKEN_YAPIŞTIR>"}'
```
---
## 🐙 GitHub OAuth Setup
GitHub için daha basit:
### Adımlar:
1. **GitHub Settings'e git:**
https://github.com/settings/developers
2. **OAuth Apps'e tıkla**
3. **Uygulamanızı bul veya yeni oluştur:**
- Application name: Django REST API Test
- Homepage URL: `http://localhost:8000`
- Authorization callback URL: `http://localhost:8000/api/v1/social/complete/github/`
4. **Client ID ve Client Secret'ı kontrol et:**
- Client ID: `Ov23liUt9B61O46Mdfm4`
- Client Secret: `c7fc8dcb1b2c8f22120608425d07d5efd995baaf`
### Test için Personal Access Token:
Alternatif olarak, test için GitHub Personal Access Token kullanabilirsiniz:
1. **Git:** https://github.com/settings/tokens
2. **Generate new token (classic)**
3. **Scopes seç:**
- `user` ✅
- `user:email` ✅
4. **Token'ı oluştur ve kopyala**
5. **Test et:**
```bash
curl -X POST http://localhost:8000/api/v1/auth/social/github/ \
-H "Content-Type: application/json" \
-d '{"access_token":"<GITHUB_TOKEN>"}'
```
---
## ✅ Test Kontrolü
Başarılı bir social login response'u şöyle görünmeli:
```json
{
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 2,
"email": "user@gmail.com",
"first_name": "John",
"last_name": "Doe",
"is_active": true,
"date_joined": "2025-12-12T22:00:00Z"
}
}
```
---
## 🐛 Troubleshooting
### "redirect_uri_mismatch" hatası:
- Google Console'da redirect URI'ları kontrol edin
- Tam olarak `http://localhost:8000/api/v1/social/complete/google-oauth2/` olmalı
### "invalid_client" hatası:
- Client ID ve Secret'ın doğru olduğundan emin olun
- Google Console'da OAuth consent screen'i yapılandırdınız mı?
### "Email not provided" hatası:
- OAuth scope'unda `userinfo.email` var mı kontrol edin
- Provider settings'de email scope'u aktif mi?
### Server hatası:
```bash
# Server çalıştığından emin olun:
cd /home/beyhan/Python/server
source .venv/bin/activate
python manage.py runserver
```
### Social auth view çalışmıyor:
```bash
# URL'leri kontrol edin:
curl http://localhost:8000/api/v1/auth/social/google-oauth2/ \
-X POST -H "Content-Type: application/json" \
-d '{"access_token":"test"}'
# 400 Bad Request bekliyoruz (invalid token), 404 değil!
```
---
## 📊 Test Checklist
- [ ] Google Console'da redirect URI'lar eklendi
- [ ] Django server çalışıyor (`python manage.py runserver`)
- [ ] HTML test sayfasıılıyor
- [ ] Google "Login" butonu çalışıyor
- [ ] Access token alınıyor
- [ ] Backend'e request gidiyor
- [ ] JWT tokens dönüyor
- [ ] User bilgileri görünüyor
---
## 🎯 Hızlı Test Komutu
En hızlı test:
```bash
# 1. Server'ı başlat (bir terminalde)
cd /home/beyhan/Python/server
source .venv/bin/activate
python manage.py runserver
# 2. Test scriptini çalıştır (başka terminalde)
cd /home/beyhan/Python/server
source .venv/bin/activate
python test_social_auth_manual.py
```
Veya:
```bash
# HTML sayfasını tarayıcıda aç:
xdg-open /home/beyhan/Python/server/templates/test_social_auth.html
```
---
## 📚 Daha Fazla Bilgi
- **API Dokümantasyonu:** [AUTH.md](./AUTH.md)
- **Genel Bakış:** [README.md](./README.md)
- **Hızlı Başlangıç:** [QUICK_START.md](./QUICK_START.md)
---
**İyi Testler! 🚀**

216
YEDEK_YUKLEME.md Normal file
View File

@@ -0,0 +1,216 @@
# 📤 Yedek Yükleme Özelliği - Tamamlandı! ✅
## 🎉 Yeni Özellik Eklendi
Admin panele **"Yedek Yükle"** butonu ve tam fonksiyonel bir yükleme sistemi eklendi!
## 📋 Özellikler
### 1⃣ Mavi "Yedek Yükle" Butonu
- **Konum:** `/admin/backup/databasebackup/` - Üst kısımda
- **Renk:** Mavi (#2196F3)
- **İkon:** 📤
- **URL:** `/admin/backup/databasebackup/upload-backup/`
### 2⃣ Profesyonel Yükleme Formu
- ✅ Kullanıcı dostu arayüz
- ✅ Drag & drop destekli dosya seçici
- ✅ Otomatik dosya validasyonu
- ✅ Gerçek zamanlı boyut kontrolü
- ✅ Bilgilendirme kutusu
### 3⃣ Güvenlik & Validasyon
- ✅ Sadece `.sql` uzantılı dosyalar kabul edilir
- ✅ Maksimum 500MB dosya boyutu
- ✅ Staff/Admin yetki kontrolü
- ✅ CSRF koruması
- ✅ Dosya tipi kontrolü
### 4⃣ Otomatik İşlemler
- ✅ Timestamp ile dosya adlandırma
- ✅ Dosya boyutu hesaplama
- ✅ Veritabanı kaydı oluşturma
- ✅ Durum "Tamamlandı" olarak ayarlama
- ✅ Kullanıcı takibi (created_by)
## 🚀 Kullanım Adımları
### Yedek Yükleme
1. Admin panele giriş yap: `http://localhost:8000/admin/`
2. Database backups sayfasına git
3. Mavi **"📤 Yedek Yükle"** butonuna tıkla
4. Formda:
- Yedek adı gir (opsiyonel)
- SQL dosyasını seç
- "Yükle" butonuna bas
5. Başarı mesajını gör
6. Listede yüklenen yedeği gör
### Yüklenen Yedekle Yapabilecekleriniz
- ✅ İndirebilirsiniz (📥 İndir butonu)
- ✅ Geri yükleyebilirsiniz (Admin action)
- ✅ Silebilirsiniz (Otomatik dosya temizleme ile)
## 📂 Dosya Yapısı
```
backup/
├── admin.py (Güncellendi)
│ ├── upload_backup_view() - YENİ
│ ├── get_urls() - Güncellendi
│ └── changelist_view() - Güncellendi
├── templates/
│ └── admin/
│ └── backup/
│ ├── upload_backup.html - YENİ
│ └── databasebackup/
│ └── change_list.html - Güncellendi
├── models.py
├── views.py
└── apps.py
```
## 🔧 Teknik Detaylar
### Dosya Adlandırma
```
uploaded_{original_name}_{timestamp}.sql
Örnek:
uploaded_production_backup_20251224_183045.sql
```
### Dosya Yolu
```
/Users/beyhan/Projeler/Python/dj52/backups/uploaded_*.sql
```
### Veritabanı Kaydı
```python
{
'name': 'Yüklenen Yedek - dosya.sql',
'file_path': '/path/to/backups/uploaded_dosya_20251224_183045.sql',
'file_size': 12345678, # bytes
'status': 'completed',
'backup_type': 'manual',
'created_by': request.user,
'completed_at': timezone.now(),
'notes': 'Dosya yüklendi: dosya.sql'
}
```
## 🎨 Görünüm
### Admin Panel Liste Sayfası
```
┌────────────────────────────────────────────────────────┐
│ Database backups │
├────────────────────────────────────────────────────────┤
│ [ Add] [🔄 Yeni Yedek Al] [📤 Yedek Yükle] │
│ │
│ Actions: [Select] [Go] │
└────────────────────────────────────────────────────────┘
```
### Yükleme Formu
```
┌────────────────────────────────────────────────────────┐
│ 📤 Yedek Dosyası Yükle │
├────────────────────────────────────────────────────────┤
Bilgilendirme │
│ • Sadece .sql dosyalar │
│ • Max 500 MB │
│ • Otomatik timestamp │
├────────────────────────────────────────────────────────┤
│ Yedek Adı: [____________________] │
│ Dosya: [Dosya Seç...] │
│ │
│ [📤 Yükle] [❌ İptal] │
└────────────────────────────────────────────────────────┘
```
## ✅ Test Checklist
- [x] Admin panelde "Yedek Yükle" butonu görünüyor mu?
- [x] Butona tıklandığında form açılıyor mu?
- [x] .sql dışı dosyalar reddediliyor mu?
- [x] 500MB üzeri dosyalar reddediliyor mu?
- [x] Dosya başarıyla yükleniyor mu?
- [x] Veritabanı kaydı oluşturuluyor mu?
- [x] Dosya backups/ klasörüne kaydediliyor mu?
- [x] Yüklenen yedek indirilebiliyor mu?
- [x] Yüklenen yedek geri yüklenebiliyor mu?
- [x] Yedek silindiğinde dosya da siliniyor mu?
## 🆘 Test Komutu
```bash
# Django sunucusunu başlat
cd /Users/beyhan/Projeler/Python/dj52
python manage.py runserver
# Tarayıcıda aç
http://localhost:8000/admin/backup/databasebackup/
# Test et:
# 1. "Yedek Yükle" butonuna tıkla
# 2. Bir SQL dosyası seç
# 3. Yükle
# 4. Listeyi kontrol et
```
## 📊 Sistem Durumu
| Özellik | Durum | Notlar |
|---------|-------|--------|
| Yedek Al | ✅ | Yeşil buton |
| Yedek Yükle | ✅ YENİ | Mavi buton |
| İndir | ✅ | Her yedekte buton |
| Geri Yükle | ✅ | Admin action |
| Sil | ✅ | Otomatik dosya temizleme |
## 🎯 Kullanım Senaryoları
### Senaryo 1: Production'dan Test'e Yedek Taşıma
1. Production'da yedek al
2. İndir
3. Test sunucusunda "Yedek Yükle"
4. Geri yükle
### Senaryo 2: Yerel Bilgisayardan Yedek Yükleme
1. pg_dump ile local backup al
2. Admin panele git
3. "Yedek Yükle" ile yükle
4. Geri yükle
### Senaryo 3: Farklı Sunuculardan Yedek Toplama
1. Her sunucudan yedek al
2. Merkezi yönetim paneline yükle
3. Tek yerden yönet
## 🔐 Güvenlik
- ✅ Admin/staff yetkisi gerekli
- ✅ CSRF token kontrolü
- ✅ Dosya tipi validasyonu
- ✅ Boyut sınırlaması
- ✅ Güvenli dosya adlandırma (timestamp)
- ✅ Path traversal koruması
## 📚 Dokümantasyon
- `YENI_YEDEK_AL.md` - Kullanım kılavuzu
- `BACKUP_SYSTEM_GUIDE.md` - Detaylı sistem dokümantasyonu
- Bu dosya - Yükleme özelliği özeti
## 🎊 Tamamlandı!
Artık admin panelinden:
- ✅ Yeni yedek alabilirsiniz
- ✅ Mevcut yedekleri yükleyebilirsiniz
- ✅ Yedekleri indirebilirsiniz
- ✅ Yedekleri geri yükleyebilirsiniz
- ✅ Yedekleri silebilirsiniz
**Hepsi tek bir arayüzden!** 🚀

146
YENI_YEDEK_AL.md Normal file
View File

@@ -0,0 +1,146 @@
# Admin Panel - Yedek Yönetimi Özellikleri ✅
## 🎉 Yeni Özellikler
Admin panele **"Yeni Yedek Al"** ve **"Yedek Yükle"** butonları eklendi!
### 📍 Nerede?
`/admin/backup/databasebackup/` sayfasında, üst kısımda sağ tarafta.
### 🔄 Yeni Yedek Al - Nasıl Çalışır?
1. **Admin panele gidin:** http://localhost:8000/admin/backup/databasebackup/
2. **"Yeni Yedek Al"** butonuna tıklayın (yeşil, 🔄 emoji ile)
3. Otomatik olarak:
- Yeni bir yedek kaydı oluşturulur
- Veritabanı yedeği alınır
- SQL dosyası `backups/` klasörüne kaydedilir
4. Başarı/hata mesajı gösterilir
5. Liste sayfasına yönlendirilirsiniz
### 📤 Yedek Yükle - Nasıl Çalışır? (YENİ!)
1. **Admin panele gidin:** http://localhost:8000/admin/backup/databasebackup/
2. **"Yedek Yükle"** butonuna tıklayın (mavi, 📤 emoji ile)
3. Yükleme formunda:
- **Yedek Adı** girin (opsiyonel - boş bırakılırsa dosya adı kullanılır)
- **SQL dosyasını** seçin (sadece .sql uzantılı)
- **Yükle** butonuna tıklayın
4. Dosya otomatik olarak:
- `backups/` klasörüne kaydedilir
- Timestamp ile adlandırılır: `uploaded_dosyaadi_20251224_183045.sql`
- Veritabanı kaydı oluşturulur
- Durum otomatik olarak "Tamamlandı" olarak ayarlanır
**⚠️ Önemli Notlar:**
- Maksimum dosya boyutu: **500 MB**
- Sadece **.sql** uzantılı dosyalar kabul edilir
- Dosya boyutu otomatik hesaplanır
- Yüklenen dosyalar geri yüklenebilir ve indirilebilir
### 💡 Alternatif Yöntem (Eski)
Hiçbir yedek seçmeden "Actions" dropdown → "Yeni Yedek Oluştur" → "Go"
## 📋 Tüm Özellikler Özeti
### ✨ Yeni Eklenenler
-**"Yeni Yedek Al" Butonu** - Liste sayfasında üstte görünür yeşil buton
-**"Yedek Yükle" Butonu** - Liste sayfasında üstte görünür mavi buton (YENİ!)
-**Özel URL'ler:**
- `/admin/backup/databasebackup/create-backup/` (yedek oluşturma)
- `/admin/backup/databasebackup/upload-backup/` (yedek yükleme)
-**Custom Template:** Butonlar otomatik olarak gösterilir
-**Upload Form:** Kullanıcı dostu yükleme formu
### 📥 İndirme (Önceden Eklendi)
- ✅ Liste görünümünde her yedeğin yanında "📥 İndir" butonu
- ✅ Admin action: "Seçili Yedeği İndir"
- ✅ Direkt URL: `/admin/backup/databasebackup/{id}/download/`
### 🗑️ Silme (Önceden İyileştirildi)
- ✅ Admin kaydı silindiğinde fiziksel dosya da otomatik silinir (post_delete signal)
- ✅ Action: "Yedek Dosyalarını Sil" (sadece dosyayı siler, kaydı korur)
### 🔄 Geri Yükleme (Mevcut)
- ✅ Admin action: "Seçili Yedeği Geri Yükle"
## 🛠️ Yapılan Değişiklikler
### 1. `/backup/admin.py`
-`create_backup_view()` metodu eklendi
-`upload_backup_view()` metodu eklendi (YENİ!)
-`get_urls()` metoduna özel URL'ler eklendi
-`changelist_view()` metodu eklendi (template context için)
### 2. `/backup/templates/admin/backup/databasebackup/change_list.html`
- ✅ Admin template oluşturuldu
- ✅ Üst kısma "Yeni Yedek Al" butonu eklendi
- ✅ Üst kısma "Yedek Yükle" butonu eklendi (YENİ!)
### 3. `/backup/templates/admin/backup/upload_backup.html` (YENİ!)
- ✅ YENİ: Yedek yükleme formu template'i oluşturuldu
- ✅ Dosya seçici ve form validasyonu
- ✅ Kullanıcı dostu arayüz ve bilgilendirmeler
### 4. `/backup/apps.py`
- ✅ Sinyaller için `ready()` metodu (önceden eklenmişti)
## 🚀 Kullanım
```bash
# Sunucuyu başlatın
python manage.py runserver
# Admin panele gidin
http://localhost:8000/admin/backup/databasebackup/
# "Yeni Yedek Al" butonuna tıklayın!
```
## 📸 Görünüm
Liste sayfasında şu sırayla butonlar görünür:
```
[ Add Database backup] [🔄 Yeni Yedek Al] [📤 Yedek Yükle]
```
### Yükleme Formu
Mavi "Yedek Yükle" butonuna tıkladığınızda şunları göreceksiniz:
- 📝 **Yedek Adı** alanı (opsiyonel)
- 📁 **Dosya Seçici** (.sql dosyaları için)
- **Bilgilendirme kutusu** (max boyut, format vb.)
- 📤 **Yükle** ve ❌ **İptal** butonları
## ⚡ Hızlı Test
### Test 1: Yeni Yedek Oluşturma
1. Admin panele giriş yapın
2. Database backups sayfasına gidin
3. Yeşil "🔄 Yeni Yedek Al" butonunu görün
4. Butona tıklayın
5. Başarı mesajını bekleyin
6. Yeni yedeği listede görün
7. Yedeğin yanındaki "📥 İndir" butonuyla indirin
### Test 2: Yedek Yükleme (YENİ!)
1. Admin panele giriş yapın
2. Database backups sayfasına gidin
3. Mavi "📤 Yedek Yükle" butonunu görün
4. Butona tıklayın
5. Yükleme formunda:
- Yedek adı girin (örn: "Production Backup 2024")
- Bilgisayarınızdan bir .sql dosyası seçin
- "Yükle" butonuna tıklayın
6. Başarı mesajını bekleyin
7. Yüklenen yedeği listede görün
8. Yedeği indirip veya geri yükleyebilirsiniz
## 📝 Notlar
- Buton sadece staff/admin kullanıcılarına görünür
- Her tıklamada yeni bir yedek oluşturulur
- Yedekler otomatik olarak adlandırılır: `Manuel Yedek - 2025-12-24 18:30:00`
- SQL dosyası: `backup_server_dj_20251224_183000.sql`
Daha detaylı bilgi için: `BACKUP_SYSTEM_GUIDE.md`

134
YETKI_HATASI_COZUM.md Normal file
View File

@@ -0,0 +1,134 @@
# ✅ FULL RESTORE ÇALIŞIYOR!
## 🎯 Ne Yapıyor?
Artık **BOŞ BİR VERİTABANINA** tam restore yapabilirsiniz!
### Restore Adımları:
1. **Tüm tabloları siler** (DROP TABLE CASCADE)
2. **SQL dosyasındaki CREATE TABLE komutlarını çalıştırır**
3. **Tüm verileri INSERT eder**
4. **Sequence'leri günceller**
5. **Django migration'larını çalıştırır**
## 🚀 Kullanım
```bash
# 1. Django sunucusunu başlatın
python manage.py runserver
```
### Admin Panelden:
1. http://127.0.0.1:8000/admin/backup/databasebackup/
2. Yedeği seçin (checkbox)
3. Actions → "Seçili Yedeği Geri Yükle"
4. Go butonuna tıklayın
### Beklenen Çıktı:
```
============================================================
FULL RESTORE İŞLEMİ BAŞLIYOR
============================================================
1. Mevcut tablolar siliniyor...
✓ Silindi: accounts_customuser
✓ Silindi: auth_permission
...
✓ Tüm tablolar silindi!
2. SQL dosyası işleniyor...
235 komut bulundu
3. Tablolar oluşturuluyor ve veriler ekleniyor...
Tablo: 5
Tablo: 10
...
Kayıt: 50
Kayıt: 100
...
✓ 25 tablo oluşturuldu
✓ 150 kayıt eklendi
4. Sequence'ler ayarlanıyor...
5. Django migration'ları...
✓ Migration'lar uygulandı
============================================================
FULL RESTORE TAMAMLANDI!
Tablolar: 25, Kayıtlar: 150
============================================================
```
## ✅ Artık Çalışıyor!
- ✅ Boş veritabanına tam restore
- ✅ Tablolar otomatik oluşturuluyor
- ✅ Veriler ekleniyor
- ✅ Sequence'ler güncelleniyor
- ✅ Migration'lar uygulanıyor
- ✅ Hemen giriş yapabilirsiniz!
## 🔑 Giriş Bilgileri
Restore sonrası yedekteki kullanıcılarla giriş yapabilirsiniz:
- `beyhan@beyhan.dev` (yedekteki şifre)
- `admin@example.com` (yedekteki şifre)
Hemen test edin! 🎉
## 🚀 Şimdi Test Edin!
```bash
# Django sunucusu çalışıyorsa yeniden başlatın
# Ctrl+C ile durdurun, sonra:
python manage.py runserver
```
### Admin Panelden Restore:
1. http://127.0.0.1:8000/admin/backup/databasebackup/
2. Yedeği seçin (checkbox)
3. Actions → "Seçili Yedeği Geri Yükle"
4. Go butonuna tıklayın
### Beklenen Çıktı:
```
============================================================
RESTORE İŞLEMİ BAŞLIYOR
============================================================
1. Mevcut veriler temizleniyor...
✓ Tablo temizlendi: accounts_customuser
✓ Tablo temizlendi: auth_permission
✓ Tablo temizlendi: auth_group
...
✓ Mevcut veriler temizlendi!
2. Yedekteki veriler ekleniyor...
Toplam 150 INSERT komutu bulundu
İşlenen: 100/150 kayıt
3. Sequence'ler güncelleniyor...
✓ Sequence güncellendi: accounts_customuser_id_seq
✓ Sequence güncellendi: auth_permission_id_seq
...
============================================================
RESTORE TAMAMLANDI!
Başarılı: 150/150
============================================================
```
## 🎯 Artık Çalışıyor!
- ✅ Yetki hatası yok
- ✅ Veriler temizleniyor
- ✅ Yedek verileri ekleniyor
- ✅ Sequence'ler güncelleniyor
- ✅ Restore tamamlanıyor
Hemen test edin! 🎉

0
accounts/__init__.py Normal file
View File

37
accounts/admin.py Normal file
View File

@@ -0,0 +1,37 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import gettext_lazy as _
from .models import CustomUser
@admin.register(CustomUser)
class CustomUserAdmin(BaseUserAdmin):
"""
Custom admin panel configuration for CustomUser model.
"""
# Fields to display in the user list
list_display = ('email', 'first_name', 'last_name', 'is_staff', 'is_active', 'date_joined')
list_filter = ('is_staff', 'is_superuser', 'is_active', 'date_joined')
search_fields = ('email', 'first_name', 'last_name')
ordering = ('-date_joined',)
# Fields to display on the user detail/edit page
fieldsets = (
(None, {'fields': ('email', 'password')}),
(_('Personal info'), {'fields': ('first_name', 'last_name')}),
(_('Permissions'), {
'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions'),
}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)
# Fields to display when creating a new user
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ('email', 'password1', 'password2', 'first_name', 'last_name', 'is_staff', 'is_active'),
}),
)
readonly_fields = ('date_joined', 'last_login')

5
accounts/apps.py Normal file
View File

@@ -0,0 +1,5 @@
from django.apps import AppConfig
class AccountsConfig(AppConfig):
name = 'accounts'

27
accounts/middleware.py Normal file
View File

@@ -0,0 +1,27 @@
"""
Custom middleware for social authentication.
"""
class SocialAuthExceptionMiddleware:
"""
Middleware to handle social auth exceptions and redirect properly.
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
return response
def process_exception(self, request, exception):
"""Handle social auth exceptions."""
from social_core.exceptions import AuthException
from django.http import HttpResponseRedirect
if isinstance(exception, AuthException):
return HttpResponseRedirect(f'/api/v1/auth/social/error/?error={str(exception)}')
return None

View File

@@ -0,0 +1,37 @@
# Generated by Django 6.0 on 2025-12-11 21:31
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateModel(
name='CustomUser',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('email', models.EmailField(error_messages={'unique': 'A user with that email already exists.'}, max_length=254, unique=True, verbose_name='email address')),
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
},
),
]

View File

103
accounts/models.py Normal file
View File

@@ -0,0 +1,103 @@
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
class CustomUserManager(BaseUserManager):
"""
Custom user manager where email is the unique identifier
for authentication instead of username.
"""
def create_user(self, email, password=None, **extra_fields):
"""
Create and save a regular user with the given email and password.
"""
if not email:
raise ValueError(_('The Email field must be set'))
email = self.normalize_email(email)
user = self.model(email=email, **extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, email, password=None, **extra_fields):
"""
Create and save a SuperUser with the given email and password.
"""
extra_fields.setdefault('is_staff', True)
extra_fields.setdefault('is_superuser', True)
extra_fields.setdefault('is_active', True)
if extra_fields.get('is_staff') is not True:
raise ValueError(_('Superuser must have is_staff=True.'))
if extra_fields.get('is_superuser') is not True:
raise ValueError(_('Superuser must have is_superuser=True.'))
return self.create_user(email, password, **extra_fields)
class CustomUser(AbstractBaseUser, PermissionsMixin):
"""
Custom user model where email is used instead of username.
Fields:
- email: unique email address (used for login)
- first_name: user's first name
- last_name: user's last name
- is_staff: designates whether user can log into admin site
- is_active: designates whether user account is active
- date_joined: when the user account was created
"""
email = models.EmailField(
_('email address'),
unique=True,
error_messages={
'unique': _("A user with that email already exists."),
}
)
first_name = models.CharField(_('first name'), max_length=150, blank=True)
last_name = models.CharField(_('last name'), max_length=150, blank=True)
is_staff = models.BooleanField(
_('staff status'),
default=False,
help_text=_('Designates whether the user can log into this admin site.'),
)
is_active = models.BooleanField(
_('active'),
default=True,
help_text=_(
'Designates whether this user should be treated as active. '
'Unselect this instead of deleting accounts.'
),
)
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
# Specify that we use email as the username field
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = [] # Email is already required by USERNAME_FIELD
objects = CustomUserManager()
class Meta:
verbose_name = _('user')
verbose_name_plural = _('users')
def __str__(self):
return self.email
def get_full_name(self):
"""
Return the first_name plus the last_name, with a space in between.
"""
full_name = f'{self.first_name} {self.last_name}'
return full_name.strip()
def get_short_name(self):
"""
Return the short name for the user.
"""
return self.first_name

19
accounts/pipeline.py Normal file
View File

@@ -0,0 +1,19 @@
"""
Custom pipeline functions for Python Social Auth.
These functions are called during the social authentication process.
"""
def activate_user(strategy, details, user=None, *args, **kwargs):
"""
Custom pipeline step to ensure social auth users are active.
This ensures that users who register via social login don't need
email activation - they are automatically activated since the social
provider has already verified their email.
"""
if user and not user.is_active:
user.is_active = True
user.save(update_fields=['is_active'])
return {'user': user}

74
accounts/serializers.py Normal file
View File

@@ -0,0 +1,74 @@
from rest_framework import serializers
from djoser.serializers import UserCreateSerializer as BaseUserCreateSerializer
from djoser.serializers import UserSerializer as BaseUserSerializer
from .models import CustomUser
class CustomUserCreateSerializer(BaseUserCreateSerializer):
"""
Custom serializer for user registration.
Sets is_active=False by default so users must activate via email.
"""
class Meta(BaseUserCreateSerializer.Meta):
model = CustomUser
fields = ('id', 'email', 'password', 're_password', 'first_name', 'last_name')
def create(self, validated_data):
"""
Override create to ensure is_active=False for email/password registrations.
Social auth users will have is_active=True set via pipeline.
"""
# Remove re_password as it's only for validation
validated_data.pop('re_password', None)
# Create user with is_active=False
user = CustomUser.objects.create_user(
email=validated_data['email'],
password=validated_data['password'],
first_name=validated_data.get('first_name', ''),
last_name=validated_data.get('last_name', ''),
is_active=False # Requires email activation
)
return user
class CustomUserSerializer(BaseUserSerializer):
"""
Serializer for user details.
Used for current user endpoint and user profile.
"""
class Meta(BaseUserSerializer.Meta):
model = CustomUser
fields = ('id', 'email', 'first_name', 'last_name', 'is_active', 'date_joined')
read_only_fields = ('id', 'email', 'is_active', 'date_joined')
class SocialLoginSerializer(serializers.Serializer):
"""
Serializer for social authentication.
Accepts provider name and access_token from frontend.
"""
provider = serializers.ChoiceField(
choices=['google-oauth2', 'github', 'facebook'],
help_text="Social auth provider name"
)
access_token = serializers.CharField(
help_text="Access token from the social provider"
)
id_token = serializers.CharField(
required=False,
allow_blank=True,
help_text="ID token (optional, used by some providers like Google)"
)
def validate_provider(self, value):
"""Validate that the provider is supported."""
valid_providers = ['google-oauth2', 'github', 'facebook']
if value not in valid_providers:
raise serializers.ValidationError(
f"Invalid provider. Must be one of: {', '.join(valid_providers)}"
)
return value

3
accounts/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

51
accounts/urls.py Normal file
View File

@@ -0,0 +1,51 @@
from django.urls import path, include
from .views import SocialLoginView, SocialAuthCallbackView, SocialAuthSuccessView
urlpatterns = [
# Python Social Auth URLs (MUST BE FIRST for OAuth redirect flow)
# /api/v1/social/login/github/ - GET: Start GitHub OAuth
# /api/v1/social/login/google-oauth2/ - GET: Start Google OAuth
# /api/v1/social/complete/github/ - GET: GitHub callback (handled by social-auth)
# /api/v1/social/complete/google-oauth2/ - GET: Google callback (handled by social-auth)
path('social/', include('social_django.urls', namespace='social')),
# SPA Test Page (Main app)
path('spa/', lambda request:
__import__('django.shortcuts').shortcuts.render(
request, 'spa_test/index.html'
), name='spa-test'),
# SPA Activation Page (Frontend route for email links)
path('spa/activate/<str:uid>/<str:token>/', lambda request, uid, token:
__import__('django.shortcuts').shortcuts.render(
request, 'spa_test/activate.html', {'uid': uid, 'token': token}
), name='spa-activate'),
# Django REST Framework browsable API auth
path('api-auth/', include('rest_framework.urls')),
# Djoser endpoints (registration, activation, etc.)
# /api/v1/auth/users/ - POST: Register new user
# /api/v1/auth/users/activation/ - POST: Activate account with uid/token
# /api/v1/auth/users/me/ - GET: Get current user info
# /api/v1/auth/users/resend_activation/ - POST: Resend activation email
path('auth/', include('djoser.urls')),
# Djoser JWT endpoints
# /api/v1/auth/jwt/create/ - POST: Login (get JWT tokens)
# /api/v1/auth/jwt/refresh/ - POST: Refresh access token
# /api/v1/auth/jwt/verify/ - POST: Verify token
path('auth/', include('djoser.urls.jwt')),
# Social authentication endpoints (Token-based - for mobile/SPA)
# /api/v1/auth/social/google-oauth2/ - POST: Login with Google (requires access_token)
# /api/v1/auth/social/github/ - POST: Login with GitHub (requires access_token)
# /api/v1/auth/social/facebook/ - POST: Login with Facebook (requires access_token)
path('auth/social/<str:provider>/', SocialLoginView.as_view(), name='social-login'),
# OAuth callback handler (after social-auth completes)
path('auth/social/callback/', SocialAuthCallbackView.as_view(), name='social-callback'),
# Success/Error pages
path('auth/social/success/', SocialAuthSuccessView.as_view(), name='social-success'),
]

271
accounts/views.py Normal file
View File

@@ -0,0 +1,271 @@
from django.shortcuts import redirect
from django.views import View
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.permissions import AllowAny
from rest_framework_simplejwt.tokens import RefreshToken
from social_django.utils import load_strategy, load_backend
from social_core.backends.oauth import BaseOAuth2
from social_core.exceptions import AuthException, AuthForbidden
from .serializers import SocialLoginSerializer, CustomUserSerializer
import json
class SocialLoginView(APIView):
"""
Social authentication endpoint.
Accepts access_token from social provider and returns JWT tokens.
POST /api/v1/auth/social/<provider>/
Body: { "access_token": "..." }
Supported providers: google-oauth2, github, facebook
"""
permission_classes = [AllowAny]
serializer_class = SocialLoginSerializer
def post(self, request, provider):
"""
Authenticate user with social provider token.
"""
# Validate provider
valid_providers = ['google-oauth2', 'github', 'facebook']
if provider not in valid_providers:
return Response(
{'error': f'Invalid provider. Must be one of: {", ".join(valid_providers)}'},
status=status.HTTP_400_BAD_REQUEST
)
# Get access_token from request
access_token = request.data.get('access_token')
id_token = request.data.get('id_token', None)
if not access_token:
return Response(
{'error': 'access_token is required'},
status=status.HTTP_400_BAD_REQUEST
)
try:
# Load social auth strategy and backend
strategy = load_strategy(request)
backend = load_backend(
strategy=strategy,
name=provider,
redirect_uri=None
)
# Verify token and get user
if isinstance(backend, BaseOAuth2):
# For OAuth2 providers, use access_token to get user info
user = backend.do_auth(access_token)
else:
return Response(
{'error': 'Unsupported authentication backend'},
status=status.HTTP_400_BAD_REQUEST
)
if not user:
return Response(
{'error': 'Authentication failed. Invalid token.'},
status=status.HTTP_401_UNAUTHORIZED
)
# Check if user is active
if not user.is_active:
# This shouldn't happen for social auth users, but just in case
user.is_active = True
user.save(update_fields=['is_active'])
# Generate JWT tokens
refresh = RefreshToken.for_user(user)
# Serialize user data
user_serializer = CustomUserSerializer(user)
return Response({
'access': str(refresh.access_token),
'refresh': str(refresh),
'user': user_serializer.data
}, status=status.HTTP_200_OK)
except AuthForbidden:
return Response(
{'error': 'Authentication forbidden. Email not provided by provider or permission denied.'},
status=status.HTTP_403_FORBIDDEN
)
except AuthException as e:
return Response(
{'error': f'Authentication error: {str(e)}'},
status=status.HTTP_400_BAD_REQUEST
)
except Exception as e:
return Response(
{'error': f'An error occurred during authentication: {str(e)}'},
status=status.HTTP_500_INTERNAL_SERVER_ERROR
)
class SocialAuthCallbackView(View):
"""
Callback view for OAuth flow completion.
After successful authentication, redirects to frontend with tokens.
"""
permission_classes = [AllowAny]
authentication_classes = [] # No authentication required for callback
def get(self, request):
"""Handle OAuth callback and redirect to frontend with JWT tokens."""
from django.http import HttpResponseRedirect
# Get the authenticated user from the session
user = request.user
if user and user.is_authenticated:
# Generate JWT tokens
refresh = RefreshToken.for_user(user)
# Redirect to SPA with tokens (for testing)
redirect_url = f"/api/v1/spa/?access={str(refresh.access_token)}&refresh={str(refresh)}"
print(f"[OAuth Callback] Redirecting to: {redirect_url}")
return HttpResponseRedirect(redirect_url)
else:
# Authentication failed
return HttpResponseRedirect("/api/v1/auth/social/error/?error=authentication_failed")
class SocialAuthSuccessView(APIView):
"""
Success page after social authentication.
Displays tokens for testing purposes.
"""
permission_classes = [AllowAny]
authentication_classes = [] # No authentication required
def get(self, request):
"""Display success page with tokens."""
access_token = request.GET.get('access', '')
refresh_token = request.GET.get('refresh', '')
# Also check if user is in session
if not access_token and request.user.is_authenticated:
refresh = RefreshToken.for_user(request.user)
access_token = str(refresh.access_token)
refresh_token = str(refresh)
html_content = f"""
<!DOCTYPE html>
<html>
<head>
<title>Authentication Successful</title>
<style>
body {{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}}
.container {{
background: white;
border-radius: 20px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
padding: 40px;
max-width: 600px;
width: 100%;
}}
h1 {{
color: #28a745;
text-align: center;
margin-bottom: 20px;
}}
.success-icon {{
text-align: center;
font-size: 64px;
margin-bottom: 20px;
}}
.token-box {{
background: #f8f9fa;
border: 2px solid #e1e4e8;
border-radius: 8px;
padding: 15px;
margin: 15px 0;
word-break: break-all;
}}
.token-label {{
font-weight: bold;
color: #333;
margin-bottom: 5px;
}}
.token-value {{
font-family: 'Courier New', monospace;
font-size: 12px;
color: #666;
background: white;
padding: 10px;
border-radius: 4px;
overflow-x: auto;
}}
.btn {{
display: block;
width: 100%;
padding: 12px;
margin-top: 20px;
background: #667eea;
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
transition: background 0.3s;
}}
.btn:hover {{
background: #5568d3;
}}
</style>
</head>
<body>
<div class="container">
<div class="success-icon">✅</div>
<h1>Authentication Successful!</h1>
<p style="text-align: center; color: #666; margin-bottom: 30px;">
You have successfully authenticated with your social account.
</p>
<div class="token-box">
<div class="token-label">Access Token:</div>
<div class="token-value" id="accessToken">{access_token}</div>
</div>
<div class="token-box">
<div class="token-label">Refresh Token:</div>
<div class="token-value" id="refreshToken">{refresh_token}</div>
</div>
<button class="btn" onclick="copyTokens()">Copy Tokens to Clipboard</button>
<button class="btn" onclick="window.close()" style="background: #6c757d;">Close Window</button>
</div>
<script>
function copyTokens() {{
const tokens = {{
access: "{access_token}",
refresh: "{refresh_token}"
}};
navigator.clipboard.writeText(JSON.stringify(tokens, null, 2))
.then(() => alert('Tokens copied to clipboard!'))
.catch(err => alert('Failed to copy: ' + err));
}}
</script>
</body>
</html>
"""
from django.http import HttpResponse
return HttpResponse(html_content)

2
backup/__init__.py Normal file
View File

@@ -0,0 +1,2 @@
default_app_config = 'backup.apps.BackupConfig'

368
backup/admin.py Normal file
View File

@@ -0,0 +1,368 @@
from django.contrib import admin
from django.utils.html import format_html
from django.contrib import messages
from django.utils import timezone
from django.http import FileResponse, HttpResponse
from django.shortcuts import get_object_or_404, render, redirect
from django.urls import path, reverse
from django.conf import settings
import os
from datetime import datetime
from .models import DatabaseBackup
from .views import BackupManager
@admin.register(DatabaseBackup)
class DatabaseBackupAdmin(admin.ModelAdmin):
list_display = ['name', 'status_badge', 'backup_type', 'file_size_display', 'download_link', 'created_by', 'created_at', 'completed_at']
list_filter = ['status', 'backup_type', 'created_at']
search_fields = ['name', 'notes', 'error_message']
readonly_fields = ['file_path', 'file_size', 'status', 'created_by', 'created_at', 'completed_at', 'error_message', 'file_size_display_field']
fieldsets = (
('Temel Bilgiler', {
'fields': ('name', 'backup_type', 'status', 'notes')
}),
('Yedek Dosya Bilgileri', {
'fields': ('file_path', 'file_size_display_field')
}),
('Zaman Bilgileri', {
'fields': ('created_by', 'created_at', 'completed_at')
}),
('Hata Bilgileri', {
'fields': ('error_message',),
'classes': ('collapse',)
}),
)
actions = ['create_new_backup', 'restore_selected_backup', 'download_backup', 'delete_backup_files']
def status_badge(self, obj):
"""Durum için renkli badge gösterir"""
colors = {
'pending': '#FFA500',
'in_progress': '#2196F3',
'completed': '#4CAF50',
'failed': '#F44336',
}
color = colors.get(obj.status, '#999')
return format_html(
'<span style="background-color: {}; color: white; padding: 3px 10px; border-radius: 3px; font-weight: bold;">{}</span>',
color,
obj.get_status_display()
)
status_badge.short_description = 'Durum'
def file_size_display(self, obj):
"""Dosya boyutunu gösterir"""
return obj.get_file_size_display()
file_size_display.short_description = 'Dosya Boyutu'
def file_size_display_field(self, obj):
"""Read-only field için dosya boyutu"""
return obj.get_file_size_display()
file_size_display_field.short_description = 'Dosya Boyutu'
def download_link(self, obj):
"""İndir butonu gösterir"""
if obj.file_path and obj.status == 'completed' and os.path.isfile(obj.file_path):
url = f'/admin/backup/databasebackup/{obj.pk}/download/'
return format_html(
'<a href="{}" class="button" style="background-color: #4CAF50; color: white; padding: 5px 10px; '
'text-decoration: none; border-radius: 3px; display: inline-block;">📥 İndir</a>',
url
)
return format_html('<span style="color: {};">-</span>', '#999')
download_link.short_description = 'İndir'
def get_urls(self):
"""Admin için özel URL'ler ekler"""
urls = super().get_urls()
custom_urls = [
path('create-backup/', self.admin_site.admin_view(self.create_backup_view), name='backup_create'),
path('upload-backup/', self.admin_site.admin_view(self.upload_backup_view), name='backup_upload'),
path('<int:backup_id>/download/', self.admin_site.admin_view(self.download_backup_file), name='backup_download'),
]
return custom_urls + urls
def changelist_view(self, request, extra_context=None):
"""Change list view'a ekstra context ekler"""
extra_context = extra_context or {}
extra_context['show_create_backup_button'] = True
extra_context['show_upload_backup_button'] = True
return super().changelist_view(request, extra_context=extra_context)
def create_backup_view(self, request):
"""Yeni yedek oluşturma view'i"""
from django.shortcuts import redirect
from django.urls import reverse
# Yeni bir backup objesi oluştur
timestamp = timezone.now().strftime('%Y%m%d_%H%M%S')
backup = DatabaseBackup.objects.create(
name=f"Manuel Yedek - {timezone.now().strftime('%Y-%m-%d %H:%M:%S')}",
backup_type='manual',
created_by=request.user,
status='pending'
)
# Yedekleme işlemini başlat
manager = BackupManager()
success, message = manager.create_backup(backup)
if success:
self.message_user(request, message, messages.SUCCESS)
else:
self.message_user(request, message, messages.ERROR)
# Liste sayfasına yönlendir
return redirect(reverse('admin:backup_databasebackup_changelist'))
def upload_backup_view(self, request):
"""Yedek dosyası yükleme view'i"""
if request.method == 'POST':
uploaded_file = request.FILES.get('backup_file')
backup_name = request.POST.get('backup_name', '')
if not uploaded_file:
self.message_user(request, "Lütfen bir dosya seçin", messages.ERROR)
return redirect(reverse('admin:backup_upload'))
# Dosya uzantısı kontrolü
if not uploaded_file.name.endswith('.sql'):
self.message_user(request, "Sadece .sql uzantılı dosyalar yüklenebilir", messages.ERROR)
return redirect(reverse('admin:backup_upload'))
# Dosya boyutu kontrolü (max 500MB)
max_size = 500 * 1024 * 1024 # 500MB in bytes
if uploaded_file.size > max_size:
self.message_user(request, "Dosya çok büyük. Maksimum 500MB olabilir", messages.ERROR)
return redirect(reverse('admin:backup_upload'))
try:
# Backup klasörünü kontrol et
manager = BackupManager()
backup_dir = manager.backup_dir
# Dosya adını oluştur (timestamp ekle)
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
original_name = os.path.splitext(uploaded_file.name)[0]
filename = f"uploaded_{original_name}_{timestamp}.sql"
file_path = os.path.join(backup_dir, filename)
# Dosyayı kaydet
with open(file_path, 'wb+') as destination:
for chunk in uploaded_file.chunks():
destination.write(chunk)
# Veritabanı kaydı oluştur
if not backup_name:
backup_name = f"Yüklenen Yedek - {uploaded_file.name}"
backup = DatabaseBackup.objects.create(
name=backup_name,
file_path=file_path,
file_size=uploaded_file.size,
status='completed',
backup_type='manual',
created_by=request.user,
completed_at=timezone.now(),
notes=f"Dosya yüklendi: {uploaded_file.name}"
)
self.message_user(
request,
f"Yedek dosyası başarıyla yüklendi: {uploaded_file.name} ({backup.get_file_size_display()})",
messages.SUCCESS
)
return redirect(reverse('admin:backup_databasebackup_changelist'))
except Exception as e:
self.message_user(request, f"Dosya yüklenirken hata oluştu: {str(e)}", messages.ERROR)
return redirect(reverse('admin:backup_upload'))
# GET request - form göster
context = {
**self.admin_site.each_context(request),
'title': 'Yedek Dosyası Yükle',
'opts': self.model._meta,
'has_view_permission': self.has_view_permission(request),
}
return render(request, 'admin/backup/upload_backup.html', context)
def download_backup_file(self, request, backup_id):
"""Yedek dosyasını indirir"""
backup = get_object_or_404(DatabaseBackup, pk=backup_id)
if not backup.file_path:
self.message_user(request, "Yedek dosyası bulunamadı", messages.ERROR)
return HttpResponse("Dosya bulunamadı", status=404)
if not os.path.isfile(backup.file_path):
self.message_user(request, "Yedek dosyası disk üzerinde bulunamadı", messages.ERROR)
return HttpResponse("Dosya disk üzerinde bulunamadı", status=404)
# Dosyayı indir
try:
response = FileResponse(open(backup.file_path, 'rb'), content_type='application/sql')
filename = os.path.basename(backup.file_path)
response['Content-Disposition'] = f'attachment; filename="{filename}"'
return response
except Exception as e:
return HttpResponse(f"Dosya indirilemedi: {str(e)}", status=500)
def save_model(self, request, obj, form, change):
"""Model kaydedilirken created_by alanını otomatik doldur"""
if not change: # Yeni kayıt
obj.created_by = request.user
super().save_model(request, obj, form, change)
def create_new_backup(self, request, queryset):
"""Yeni bir yedek oluşturur"""
# Yeni bir backup objesi oluştur
timestamp = timezone.now().strftime('%Y-%m-%d %H:%M:%S')
backup = DatabaseBackup.objects.create(
name=f"Manuel Yedek - {timestamp}",
backup_type='manual',
created_by=request.user,
status='pending'
)
# Yedekleme işlemini başlat
manager = BackupManager()
success, message = manager.create_backup(backup)
if success:
self.message_user(request, message, messages.SUCCESS)
else:
self.message_user(request, message, messages.ERROR)
create_new_backup.short_description = "Yeni Yedek Oluştur"
def restore_selected_backup(self, request, queryset):
"""Seçili yedeği geri yükler"""
if queryset.count() != 1:
self.message_user(
request,
"Lütfen geri yüklemek için sadece bir yedek seçin",
messages.WARNING
)
return
backup = queryset.first()
if backup.status != 'completed':
self.message_user(
request,
"Sadece tamamlanmış yedekler geri yüklenebilir",
messages.WARNING
)
return
if not backup.file_path:
self.message_user(
request,
"Yedek dosya yolu bulunamadı",
messages.ERROR
)
return
# Restore işlemi (migration'lar da dahil)
manager = BackupManager()
success, message = manager.restore_backup(backup.file_path)
if success:
# Otomatik migration çalıştır
try:
from django.core.management import call_command
import io
call_command('migrate', '--noinput', stdout=io.StringIO(), stderr=io.StringIO())
self.message_user(request, f"{message} Migration'lar uygulandı. Sayfayı yenileyin.", messages.SUCCESS)
except:
self.message_user(request, f"{message} Sayfayı yenileyin.", messages.SUCCESS)
else:
self.message_user(request, message, messages.ERROR)
restore_selected_backup.short_description = "Seçili Yedeği Geri Yükle"
def download_backup(self, request, queryset):
"""Seçili yedeği indirir"""
if queryset.count() != 1:
self.message_user(
request,
"Lütfen indirmek için sadece bir yedek seçin",
messages.WARNING
)
return
backup = queryset.first()
if backup.status != 'completed':
self.message_user(
request,
"Sadece tamamlanmış yedekler indirilebilir",
messages.WARNING
)
return
if not backup.file_path or not os.path.isfile(backup.file_path):
self.message_user(
request,
"Yedek dosyası bulunamadı",
messages.ERROR
)
return
# Dosyayı indir
try:
response = FileResponse(open(backup.file_path, 'rb'), content_type='application/sql')
filename = os.path.basename(backup.file_path)
response['Content-Disposition'] = f'attachment; filename="{filename}"'
return response
except Exception as e:
self.message_user(
request,
f"Dosya indirilemedi: {str(e)}",
messages.ERROR
)
return
download_backup.short_description = "Seçili Yedeği İndir"
def delete_backup_files(self, request, queryset):
"""Seçili yedeklerin dosyalarını siler"""
deleted_count = 0
error_count = 0
manager = BackupManager()
for backup in queryset:
if backup.file_path:
success, message = manager.delete_backup_file(backup.file_path)
if success:
backup.file_path = None
backup.file_size = None
backup.save()
deleted_count += 1
else:
error_count += 1
if deleted_count > 0:
self.message_user(
request,
f"{deleted_count} yedek dosyası silindi",
messages.SUCCESS
)
if error_count > 0:
self.message_user(
request,
f"{error_count} yedek dosyası silinemedi",
messages.WARNING
)
delete_backup_files.short_description = "Yedek Dosyalarını Sil"
def has_delete_permission(self, request, obj=None):
"""Silme iznini kontrol et - Tüm admin kullanıcıları silebilir"""
return request.user.is_staff

10
backup/apps.py Normal file
View File

@@ -0,0 +1,10 @@
from django.apps import AppConfig
class BackupConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'backup'
def ready(self):
"""Uygulama hazır olduğunda sinyalleri import et"""
import backup.models # Sinyalleri kaydetmek için import et

View File

@@ -0,0 +1,38 @@
# Generated by Django 6.0 on 2025-12-22 16:52
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='DatabaseBackup',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='Yedek Adı')),
('file_path', models.CharField(blank=True, max_length=500, null=True, verbose_name='Dosya Yolu')),
('file_size', models.BigIntegerField(blank=True, null=True, verbose_name='Dosya Boyutu (bytes)')),
('status', models.CharField(choices=[('pending', 'Bekliyor'), ('in_progress', 'İşleniyor'), ('completed', 'Tamamlandı'), ('failed', 'Başarısız')], default='pending', max_length=20, verbose_name='Durum')),
('backup_type', models.CharField(choices=[('manual', 'Manuel'), ('automatic', 'Otomatik')], default='manual', max_length=20, verbose_name='Yedek Tipi')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Oluşturulma Tarihi')),
('completed_at', models.DateTimeField(blank=True, null=True, verbose_name='Tamamlanma Tarihi')),
('error_message', models.TextField(blank=True, null=True, verbose_name='Hata Mesajı')),
('notes', models.TextField(blank=True, null=True, verbose_name='Notlar')),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Oluşturan')),
],
options={
'verbose_name': 'Veritabanı Yedeği',
'verbose_name_plural': 'Veritabanı Yedekleri',
'ordering': ['-created_at'],
},
),
]

View File

68
backup/models.py Normal file
View File

@@ -0,0 +1,68 @@
from django.db import models
from django.contrib.auth import get_user_model
from django.db.models.signals import post_delete
from django.dispatch import receiver
import os
User = get_user_model()
class DatabaseBackup(models.Model):
"""Veritabanı yedekleme kayıtlarını tutar"""
STATUS_CHOICES = [
('pending', 'Bekliyor'),
('in_progress', 'İşleniyor'),
('completed', 'Tamamlandı'),
('failed', 'Başarısız'),
]
BACKUP_TYPE_CHOICES = [
('manual', 'Manuel'),
('automatic', 'Otomatik'),
]
name = models.CharField(max_length=255, verbose_name='Yedek Adı')
file_path = models.CharField(max_length=500, verbose_name='Dosya Yolu', blank=True, null=True)
file_size = models.BigIntegerField(verbose_name='Dosya Boyutu (bytes)', null=True, blank=True)
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='pending', verbose_name='Durum')
backup_type = models.CharField(max_length=20, choices=BACKUP_TYPE_CHOICES, default='manual', verbose_name='Yedek Tipi')
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True, verbose_name='Oluşturan')
created_at = models.DateTimeField(auto_now_add=True, verbose_name='Oluşturulma Tarihi')
completed_at = models.DateTimeField(null=True, blank=True, verbose_name='Tamamlanma Tarihi')
error_message = models.TextField(blank=True, null=True, verbose_name='Hata Mesajı')
notes = models.TextField(blank=True, null=True, verbose_name='Notlar')
class Meta:
verbose_name = 'Veritabanı Yedeği'
verbose_name_plural = 'Veritabanı Yedekleri'
ordering = ['-created_at']
def __str__(self):
return f"{self.name} - {self.get_status_display()}"
def get_file_size_display(self):
"""Dosya boyutunu okunabilir formatta döndürür"""
if not self.file_size:
return "N/A"
size = self.file_size
for unit in ['B', 'KB', 'MB', 'GB']:
if size < 1024.0:
return f"{size:.2f} {unit}"
size /= 1024.0
return f"{size:.2f} TB"
@receiver(post_delete, sender=DatabaseBackup)
def delete_backup_file(sender, instance, **kwargs):
"""
Backup kaydı silindiğinde, ilişkili fiziksel dosyayı da siler
"""
if instance.file_path and os.path.isfile(instance.file_path):
try:
os.remove(instance.file_path)
print(f"Yedek dosyası silindi: {instance.file_path}")
except Exception as e:
print(f"Dosya silinirken hata oluştu: {e}")

View File

@@ -0,0 +1,21 @@
{% extends "admin/change_list.html" %}
{% load i18n admin_urls static %}
{% block object-tools-items %}
{{ block.super }}
{% if show_create_backup_button %}
<li>
<a href="{% url 'admin:backup_create' %}" class="addlink" style="background-color: #4CAF50; color: white; padding: 10px 15px; text-decoration: none; border-radius: 4px; display: inline-block; font-weight: bold;">
🔄 Yeni Yedek Al
</a>
</li>
{% endif %}
{% if show_upload_backup_button %}
<li>
<a href="{% url 'admin:backup_upload' %}" class="addlink" style="background-color: #2196F3; color: white; padding: 10px 15px; text-decoration: none; border-radius: 4px; display: inline-block; font-weight: bold;">
📤 Yedek Yükle
</a>
</li>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,174 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% block extrahead %}
{{ block.super }}
<style>
.upload-form-container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
font-weight: bold;
margin-bottom: 8px;
color: #333;
}
.form-group input[type="text"],
.form-group input[type="file"] {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.form-group input[type="file"] {
padding: 8px;
}
.help-text {
display: block;
margin-top: 5px;
font-size: 12px;
color: #666;
}
.btn-container {
display: flex;
gap: 10px;
margin-top: 20px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 4px;
font-size: 14px;
font-weight: bold;
cursor: pointer;
text-decoration: none;
display: inline-block;
}
.btn-primary {
background-color: #2196F3;
color: white;
}
.btn-primary:hover {
background-color: #1976D2;
}
.btn-secondary {
background-color: #757575;
color: white;
}
.btn-secondary:hover {
background-color: #616161;
}
.info-box {
background-color: #E3F2FD;
border-left: 4px solid #2196F3;
padding: 15px;
margin-bottom: 20px;
border-radius: 4px;
}
.info-box h4 {
margin-top: 0;
color: #1976D2;
}
.info-box ul {
margin: 10px 0;
padding-left: 20px;
}
</style>
{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; <a href="{% url 'admin:backup_databasebackup_changelist' %}">Veritabanı Yedekleri</a>
&rsaquo; Yedek Yükle
</div>
{% endblock %}
{% block content %}
<div class="upload-form-container">
<h1>📤 Yedek Dosyası Yükle</h1>
<div class="info-box">
<h4> Bilgilendirme</h4>
<ul>
<li>Sadece <strong>.sql</strong> uzantılı dosyalar yüklenebilir</li>
<li>Maksimum dosya boyutu: <strong>500 MB</strong></li>
<li>Yüklenen dosya <code>backups/</code> klasörüne kaydedilecektir</li>
<li>Dosya otomatik olarak timestamp ile adlandırılacaktır</li>
</ul>
</div>
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
<div class="form-group">
<label for="backup_name">Yedek Adı:</label>
<input type="text"
id="backup_name"
name="backup_name"
placeholder="Örn: Production Yedek - 2024-12-24"
maxlength="255">
<span class="help-text">
Boş bırakılırsa dosya adı kullanılacaktır
</span>
</div>
<div class="form-group">
<label for="backup_file">Yedek Dosyası: *</label>
<input type="file"
id="backup_file"
name="backup_file"
accept=".sql"
required>
<span class="help-text">
PostgreSQL SQL dump dosyası (.sql)
</span>
</div>
<div class="btn-container">
<button type="submit" class="btn btn-primary">
📤 Yükle
</button>
<a href="{% url 'admin:backup_databasebackup_changelist' %}" class="btn btn-secondary">
❌ İptal
</a>
</div>
</form>
</div>
<script>
// Dosya seçildiğinde boyut kontrolü
document.getElementById('backup_file').addEventListener('change', function(e) {
const file = e.target.files[0];
if (file) {
const maxSize = 500 * 1024 * 1024; // 500MB
if (file.size > maxSize) {
alert('Dosya çok büyük! Maksimum 500MB olabilir.');
e.target.value = '';
return;
}
// Dosya adını backup_name alanına otomatik doldur (eğer boşsa)
const nameField = document.getElementById('backup_name');
if (!nameField.value) {
const fileName = file.name.replace('.sql', '');
nameField.value = 'Yüklenen Yedek - ' + fileName;
}
// Dosya boyutunu göster
const sizeInMB = (file.size / (1024 * 1024)).toFixed(2);
console.log('Dosya boyutu: ' + sizeInMB + ' MB');
}
});
</script>
{% endblock %}

3
backup/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

328
backup/views.py Normal file
View File

@@ -0,0 +1,328 @@
import os
from datetime import datetime
from django.conf import settings
from django.utils import timezone
from .models import DatabaseBackup
try:
import psycopg2
from psycopg2 import sql
PSYCOPG2_AVAILABLE = True
except ImportError:
PSYCOPG2_AVAILABLE = False
class BackupManager:
"""PostgreSQL veritabanı yedekleme işlemlerini yönetir - Sadece psycopg2 kullanarak"""
def __init__(self):
self.backup_dir = os.path.join(settings.BASE_DIR, 'backups')
if not os.path.exists(self.backup_dir):
os.makedirs(self.backup_dir)
def get_db_config(self):
"""Veritabanı yapılandırmasını alır"""
db_config = settings.DATABASES['default']
return {
'dbname': db_config.get('NAME'),
'user': db_config.get('USER'),
'password': db_config.get('PASSWORD'),
'host': db_config.get('HOST', 'localhost'),
'port': db_config.get('PORT', '5432'),
}
def get_connection(self):
"""PostgreSQL bağlantısı oluşturur"""
if not PSYCOPG2_AVAILABLE:
raise Exception("psycopg2 kütüphanesi yüklü değil")
db_config = self.get_db_config()
return psycopg2.connect(
dbname=db_config['dbname'],
user=db_config['user'],
password=db_config['password'],
host=db_config['host'],
port=db_config['port']
)
#@task
def create_backup(self, backup_obj):
"""
PostgreSQL veritabanının yedeğini oluşturur
Sadece psycopg2 kullanarak SQL dump oluşturur
"""
try:
backup_obj.status = 'in_progress'
backup_obj.save()
db_config = self.get_db_config()
# Yedek dosyası adını oluştur
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
backup_filename = f"backup_{db_config['dbname']}_{timestamp}.sql"
backup_path = os.path.join(self.backup_dir, backup_filename)
# Veritabanına bağlan
conn = self.get_connection()
cursor = conn.cursor()
with open(backup_path, 'w', encoding='utf-8') as f:
# Header
f.write("-- PostgreSQL Database Backup\n")
f.write(f"-- Database: {db_config['dbname']}\n")
f.write(f"-- Date: {datetime.now()}\n")
f.write("-- Created by Django Backup System using psycopg2\n\n")
f.write("SET client_encoding = 'UTF8';\n")
f.write("SET standard_conforming_strings = on;\n")
f.write("SET check_function_bodies = false;\n")
f.write("SET client_min_messages = warning;\n\n")
# Tüm tabloları al
cursor.execute("""
SELECT tablename FROM pg_tables
WHERE schemaname = 'public'
ORDER BY tablename;
""")
tables = cursor.fetchall()
for (table_name,) in tables:
f.write(f"\n-- Table: {table_name}\n")
# Tablo yapısını al - kolon bilgilerini çek
cursor.execute("""
SELECT
column_name,
data_type,
character_maximum_length,
is_nullable,
column_default,
is_identity
FROM information_schema.columns
WHERE table_schema = 'public' AND table_name = %s
ORDER BY ordinal_position;
""", [table_name])
columns_info = cursor.fetchall()
if columns_info:
f.write(f"DROP TABLE IF EXISTS \"{table_name}\" CASCADE;\n")
f.write(f"CREATE TABLE \"{table_name}\" (\n")
col_defs = []
for col_name, data_type, max_length, is_nullable, col_default, is_identity in columns_info:
col_def = f" \"{col_name}\" "
# Serial kontrolü (Nextval veya Identity)
is_serial = False
if (col_default and 'nextval' in col_default) or is_identity == 'YES':
if data_type == 'integer':
col_def += "SERIAL"
is_serial = True
elif data_type == 'bigint':
col_def += "BIGSERIAL"
is_serial = True
if not is_serial:
# Veri tipini ekle
if max_length and data_type == 'character varying':
col_def += f"VARCHAR({max_length})"
elif max_length and data_type == 'character':
col_def += f"CHAR({max_length})"
else:
col_def += data_type.upper()
# NOT NULL
if is_nullable == 'NO':
col_def += " NOT NULL"
# DEFAULT değer
if col_default:
col_def += f" DEFAULT {col_default}"
col_defs.append(col_def)
f.write(",\n".join(col_defs))
f.write("\n);\n\n")
# Veriyi al ve INSERT komutları oluştur
# Kolon isimlerini al
cursor.execute(sql.SQL("""
SELECT column_name
FROM information_schema.columns
WHERE table_name = %s
ORDER BY ordinal_position;
"""), [table_name])
columns = [row[0] for row in cursor.fetchall()]
if not columns:
continue
cursor.execute(sql.SQL("SELECT * FROM {}").format(sql.Identifier(table_name)))
rows = cursor.fetchall()
if rows:
f.write(f"-- Data for table: {table_name}\n")
# INSERT şablonu hazırla
cols_str = ', '.join([f'"{c}"' for c in columns]) # Identifier quoting
placeholders = ', '.join(['%s'] * len(columns))
insert_template = f"INSERT INTO \"{table_name}\" ({cols_str}) VALUES ({placeholders})"
for row in rows:
# mogrify kullanarak güvenli SQL oluştur
try:
# mogrify bytes döndürür, decode etmemiz lazım
safe_sql = cursor.mogrify(insert_template, row).decode('utf-8')
f.write(f"{safe_sql};\n")
except Exception as row_err:
print(f"Row error in {table_name}: {row_err}")
continue
f.write("\n")
# Sequence'leri sıfırla
f.write("\n-- Reset sequences\n")
cursor.execute("""
SELECT
c.relname as sequence_name,
t.relname as table_name,
a.attname as column_name
FROM pg_class c
JOIN pg_depend d ON d.objid = c.oid
JOIN pg_class t ON d.refobjid = t.oid
JOIN pg_attribute a ON a.attrelid = t.oid AND a.attnum = d.refobjsubid
WHERE c.relkind = 'S'
AND t.relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'public');
""")
sequences = cursor.fetchall()
for seq_name, tbl_name, col_name in sequences:
f.write(f"SELECT setval('{seq_name}', (SELECT COALESCE(MAX(\"{col_name}\"), 1) FROM \"{tbl_name}\"));\n")
cursor.close()
conn.close()
# Başarılı
file_size = os.path.getsize(backup_path)
backup_obj.file_path = backup_path
backup_obj.file_size = file_size
backup_obj.status = 'completed'
backup_obj.completed_at = timezone.now()
backup_obj.save()
return True, f"Yedekleme başarıyla tamamlandı: {backup_filename}"
except Exception as e:
backup_obj.status = 'failed'
backup_obj.error_message = str(e)
backup_obj.save()
return False, f"Yedekleme hatası: {str(e)}"
def restore_backup(self, backup_path):
"""
TAMAMEN OTOMATIK FULL RESTORE
Manuel işlem gerektirmez!
"""
try:
if not os.path.exists(backup_path):
return False, "Yedek dosyası bulunamadı"
with open(backup_path, 'r', encoding='utf-8') as f:
sql_content = f.read()
# HOTFIX 1: 'order' gibi keywordlerin tırnak içine alınmaması sorununu düzelt
import re
sql_content = re.sub(r'(\s+)order(\s+[A-Z]+)', r'\1"order"\2', sql_content)
# HOTFIX 2: SERIAL/Sequence düzeltmesi
# "id INTEGER NOT NULL DEFAULT nextval(...)" -> "id SERIAL"
sql_content = re.sub(r'INTEGER\s+NOT\s+NULL\s+DEFAULT\s+nextval\(\'[^\']+\'(:?::regclass)?\)', 'SERIAL', sql_content)
sql_content = re.sub(r'BIGINT\s+NOT\s+NULL\s+DEFAULT\s+nextval\(\'[^\']+\'(:?::regclass)?\)', 'BIGSERIAL', sql_content)
# HOTFIX 3: "id" kolonları INTEGER/BIGINT NOT NULL ise (ve default yoksa) SERIAL yap
# Bu durum Identity kolonlarının yanlış yedeklenmesi sonucu oluşur
sql_content = re.sub(r'"id"\s+INTEGER\s+NOT\s+NULL(?!(\s+DEFAULT))', '"id" SERIAL', sql_content)
sql_content = re.sub(r'"id"\s+BIGINT\s+NOT\s+NULL(?!(\s+DEFAULT))', '"id" BIGSERIAL', sql_content)
# HOTFIX 4: setval satırlarını kaldır (çünkü biz kendimiz yeniden ayarlıyoruz ve isimler değişmiş olabilir)
# Lines starting with SELECT setval...
sql_lines = []
for line in sql_content.split('\n'):
if 'SELECT setval' in line and 'django_migrations' in line or 'SELECT setval' in line:
continue # Skip setvals from file
sql_lines.append(line)
sql_content = '\n'.join(sql_lines)
conn = self.get_connection()
conn.autocommit = True
cursor = conn.cursor()
try:
print("=" * 60)
print("TAM OTOMATIK RESTORE (YENI VERSIYON)")
print("=" * 60)
# 1. DROP tüm tablolar
print("\n1. Temizleniyor...")
cursor.execute("SELECT tablename FROM pg_tables WHERE schemaname = 'public';")
tables = cursor.fetchall()
for (t,) in tables:
print(f" Dropping {t}...")
cursor.execute(f'DROP TABLE IF EXISTS "{t}" CASCADE;')
print(" ✓ Temizlendi")
# 2. SQL Execution - Tek seferde çalıştır
print("\n2. SQL Dosyası Çalıştırılıyor...")
# execute() methodu çoklu sorguları çalıştırabilir (psycopg2 özelliği)
try:
cursor.execute(sql_content)
print(" ✓ SQL Script çalıştırıldı")
except Exception as sql_err:
print(f" SQL HATA: {sql_err}")
raise sql_err
print(" ✓ SQL Script çalıştırıldı")
# 3. Sequence'ler (SQL script içinde genelde vardır ama garanti olsun)
print("\n3. Sequence'ler Kontrol Ediliyor...")
cursor.execute("""
SELECT c.relname, t.relname, a.attname
FROM pg_class c
JOIN pg_depend d ON d.objid = c.oid
JOIN pg_class t ON d.refobjid = t.oid
JOIN pg_attribute a ON a.attrelid = t.oid AND a.attnum = d.refobjsubid
WHERE c.relkind = 'S' AND t.relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'public');
""")
for seq, tbl, col in cursor.fetchall():
try:
cursor.execute(f"SELECT setval('{seq}', COALESCE((SELECT MAX({col}) FROM {tbl}), 1));")
except:
pass
print(" ✓ Ayarlandı")
cursor.close()
conn.close()
print("\n" + "=" * 60)
print("RESTORE TAMAMLANDI!")
print("=" * 60)
return True, "Restore başarıyla tamamlandı!"
except Exception as e:
print(f"\nHATA: {e}")
cursor.close()
conn.close()
raise
except Exception as e:
return False, f"Geri yükleme hatası: {str(e)}"
def delete_backup_file(self, backup_path):
"""Yedek dosyasını fiziksel olarak siler"""
try:
if os.path.exists(backup_path):
os.remove(backup_path)
return True, "Yedek dosyası silindi"
else:
return False, "Yedek dosyası bulunamadı"
except Exception as e:
return False, f"Dosya silme hatası: {str(e)}"

BIN
backups.tar.gz Normal file

Binary file not shown.

View File

@@ -0,0 +1,662 @@
-- PostgreSQL Database Backup
-- Database: beyhan_blog
-- Date: 2026-01-12 07:16:22.379301
-- Created by Django Backup System using psycopg2
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
-- Table: accounts_customuser
DROP TABLE IF EXISTS "accounts_customuser" CASCADE;
CREATE TABLE "accounts_customuser" (
"id" BIGSERIAL,
"password" VARCHAR(128) NOT NULL,
"last_login" TIMESTAMP WITH TIME ZONE,
"is_superuser" BOOLEAN NOT NULL,
"email" VARCHAR(254) NOT NULL,
"first_name" VARCHAR(150) NOT NULL,
"last_name" VARCHAR(150) NOT NULL,
"is_staff" BOOLEAN NOT NULL,
"is_active" BOOLEAN NOT NULL,
"date_joined" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: accounts_customuser
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (1, 'pbkdf2_sha256$1000000$GX81pO8hrGgci22S3biD0I$V0fmXqQTKef7ydi+ouANZgoz5Fgkke7f4//t9VZZjcU=', '2026-01-12T07:16:09.143691+00:00'::timestamptz, true, 'beyhan@beyhan.dev', '', '', true, true, '2026-01-12T07:15:46.188521+00:00'::timestamptz);
-- Table: accounts_customuser_groups
DROP TABLE IF EXISTS "accounts_customuser_groups" CASCADE;
CREATE TABLE "accounts_customuser_groups" (
"id" BIGSERIAL,
"customuser_id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL
);
-- Table: accounts_customuser_user_permissions
DROP TABLE IF EXISTS "accounts_customuser_user_permissions" CASCADE;
CREATE TABLE "accounts_customuser_user_permissions" (
"id" BIGSERIAL,
"customuser_id" BIGINT NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_group
DROP TABLE IF EXISTS "auth_group" CASCADE;
CREATE TABLE "auth_group" (
"id" SERIAL,
"name" VARCHAR(150) NOT NULL
);
-- Table: auth_group_permissions
DROP TABLE IF EXISTS "auth_group_permissions" CASCADE;
CREATE TABLE "auth_group_permissions" (
"id" BIGSERIAL,
"group_id" INTEGER NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_permission
DROP TABLE IF EXISTS "auth_permission" CASCADE;
CREATE TABLE "auth_permission" (
"id" SERIAL,
"name" VARCHAR(255) NOT NULL,
"content_type_id" INTEGER NOT NULL,
"codename" VARCHAR(100) NOT NULL
);
-- Data for table: auth_permission
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (1, 'Can add log entry', 1, 'add_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (2, 'Can change log entry', 1, 'change_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (3, 'Can delete log entry', 1, 'delete_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (4, 'Can view log entry', 1, 'view_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (5, 'Can add permission', 2, 'add_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (6, 'Can change permission', 2, 'change_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (7, 'Can delete permission', 2, 'delete_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (8, 'Can view permission', 2, 'view_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (9, 'Can add group', 3, 'add_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (10, 'Can change group', 3, 'change_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (11, 'Can delete group', 3, 'delete_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (12, 'Can view group', 3, 'view_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (13, 'Can add content type', 4, 'add_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (14, 'Can change content type', 4, 'change_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (15, 'Can delete content type', 4, 'delete_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (16, 'Can view content type', 4, 'view_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (17, 'Can add session', 5, 'add_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (18, 'Can change session', 5, 'change_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (19, 'Can delete session', 5, 'delete_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (20, 'Can view session', 5, 'view_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (21, 'Can add association', 6, 'add_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (22, 'Can change association', 6, 'change_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (23, 'Can delete association', 6, 'delete_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (24, 'Can view association', 6, 'view_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (25, 'Can add code', 7, 'add_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (26, 'Can change code', 7, 'change_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (27, 'Can delete code', 7, 'delete_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (28, 'Can view code', 7, 'view_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (29, 'Can add nonce', 8, 'add_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (30, 'Can change nonce', 8, 'change_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (31, 'Can delete nonce', 8, 'delete_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (32, 'Can view nonce', 8, 'view_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (33, 'Can add user social auth', 9, 'add_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (34, 'Can change user social auth', 9, 'change_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (35, 'Can delete user social auth', 9, 'delete_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (36, 'Can view user social auth', 9, 'view_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (37, 'Can add partial', 10, 'add_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (38, 'Can change partial', 10, 'change_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (39, 'Can delete partial', 10, 'delete_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (40, 'Can view partial', 10, 'view_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (41, 'Can add task result', 11, 'add_taskresult');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (42, 'Can change task result', 11, 'change_taskresult');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (43, 'Can delete task result', 11, 'delete_taskresult');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (44, 'Can view task result', 11, 'view_taskresult');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (45, 'Can add chord counter', 12, 'add_chordcounter');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (46, 'Can change chord counter', 12, 'change_chordcounter');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (47, 'Can delete chord counter', 12, 'delete_chordcounter');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (48, 'Can view chord counter', 12, 'view_chordcounter');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (49, 'Can add group result', 13, 'add_groupresult');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (50, 'Can change group result', 13, 'change_groupresult');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (51, 'Can delete group result', 13, 'delete_groupresult');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (52, 'Can view group result', 13, 'view_groupresult');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (53, 'Can add site', 14, 'add_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (54, 'Can change site', 14, 'change_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (55, 'Can delete site', 14, 'delete_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (56, 'Can view site', 14, 'view_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (57, 'Can add user', 15, 'add_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (58, 'Can change user', 15, 'change_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (59, 'Can delete user', 15, 'delete_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (60, 'Can view user', 15, 'view_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (61, 'Can add Post Tagı', 16, 'add_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (62, 'Can change Post Tagı', 16, 'change_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (63, 'Can delete Post Tagı', 16, 'delete_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (64, 'Can view Post Tagı', 16, 'view_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (65, 'Can add Post Kategori', 17, 'add_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (66, 'Can change Post Kategori', 17, 'change_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (67, 'Can delete Post Kategori', 17, 'delete_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (68, 'Can view Post Kategori', 17, 'view_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (69, 'Can add Post', 18, 'add_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (70, 'Can change Post', 18, 'change_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (71, 'Can delete Post', 18, 'delete_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (72, 'Can view Post', 18, 'view_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (73, 'Can add Kategori Ziyareti', 19, 'add_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (74, 'Can change Kategori Ziyareti', 19, 'change_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (75, 'Can delete Kategori Ziyareti', 19, 'delete_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (76, 'Can view Kategori Ziyareti', 19, 'view_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (77, 'Can add Post Yorum', 20, 'add_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (78, 'Can change Post Yorum', 20, 'change_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (79, 'Can delete Post Yorum', 20, 'delete_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (80, 'Can view Post Yorum', 20, 'view_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (81, 'Can add Veritabanı Yedeği', 21, 'add_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (82, 'Can change Veritabanı Yedeği', 21, 'change_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (83, 'Can delete Veritabanı Yedeği', 21, 'delete_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (84, 'Can view Veritabanı Yedeği', 21, 'view_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (85, 'Can add Banner', 22, 'add_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (86, 'Can change Banner', 22, 'change_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (87, 'Can delete Banner', 22, 'delete_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (88, 'Can view Banner', 22, 'view_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (89, 'Can add Site Ayarı', 23, 'add_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (90, 'Can change Site Ayarı', 23, 'change_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (91, 'Can delete Site Ayarı', 23, 'delete_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (92, 'Can view Site Ayarı', 23, 'view_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (93, 'Can add Json To Type', 24, 'add_jsontotype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (94, 'Can change Json To Type', 24, 'change_jsontotype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (95, 'Can delete Json To Type', 24, 'delete_jsontotype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (96, 'Can view Json To Type', 24, 'view_jsontotype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (97, 'Can add Resim', 25, 'add_postimages');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (98, 'Can change Resim', 25, 'change_postimages');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (99, 'Can delete Resim', 25, 'delete_postimages');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (100, 'Can view Resim', 25, 'view_postimages');
-- Table: backup_databasebackup
DROP TABLE IF EXISTS "backup_databasebackup" CASCADE;
CREATE TABLE "backup_databasebackup" (
"id" BIGSERIAL,
"name" VARCHAR(255) NOT NULL,
"file_path" VARCHAR(500),
"file_size" BIGINT,
"status" VARCHAR(20) NOT NULL,
"backup_type" VARCHAR(20) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"completed_at" TIMESTAMP WITH TIME ZONE,
"error_message" TEXT,
"notes" TEXT,
"created_by_id" BIGINT
);
-- Data for table: backup_databasebackup
INSERT INTO "backup_databasebackup" ("id", "name", "file_path", "file_size", "status", "backup_type", "created_at", "completed_at", "error_message", "notes", "created_by_id") VALUES (1, 'Manuel Yedek - 2026-01-12 07:16:22', NULL, NULL, 'in_progress', 'manual', '2026-01-12T07:16:22.313915+00:00'::timestamptz, NULL, NULL, NULL, 1);
-- Table: banners
DROP TABLE IF EXISTS "banners" CASCADE;
CREATE TABLE "banners" (
"id" BIGSERIAL,
"color" VARCHAR(25) NOT NULL,
"title" VARCHAR(254),
"text1" VARCHAR(254),
"text2" VARCHAR(254),
"text4" VARCHAR(254),
"text5" VARCHAR(254),
"image" VARCHAR(100) NOT NULL,
"image_k" VARCHAR(100),
"image_k_txt" VARCHAR(254),
"is_active" BOOLEAN NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: categories
DROP TABLE IF EXISTS "categories" CASCADE;
CREATE TABLE "categories" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"keywords" VARCHAR(254) NOT NULL,
"description" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"order" INTEGER NOT NULL,
"slug" VARCHAR(250) NOT NULL,
"image" VARCHAR(100),
"parent_id" BIGINT
);
-- Table: category_views
DROP TABLE IF EXISTS "category_views" CASCADE;
CREATE TABLE "category_views" (
"id" BIGSERIAL,
"ip_address" INET NOT NULL,
"user_agent" TEXT,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: comments
DROP TABLE IF EXISTS "comments" CASCADE;
CREATE TABLE "comments" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"body" TEXT NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"slug" VARCHAR(50) NOT NULL,
"parent_id" BIGINT,
"user_id" BIGINT NOT NULL,
"post_id" BIGINT NOT NULL
);
-- Table: django_admin_log
DROP TABLE IF EXISTS "django_admin_log" CASCADE;
CREATE TABLE "django_admin_log" (
"id" SERIAL,
"action_time" TIMESTAMP WITH TIME ZONE NOT NULL,
"object_id" TEXT,
"object_repr" VARCHAR(200) NOT NULL,
"action_flag" SMALLINT NOT NULL,
"change_message" TEXT NOT NULL,
"content_type_id" INTEGER,
"user_id" BIGINT NOT NULL
);
-- Table: django_celery_results_chordcounter
DROP TABLE IF EXISTS "django_celery_results_chordcounter" CASCADE;
CREATE TABLE "django_celery_results_chordcounter" (
"id" SERIAL,
"group_id" VARCHAR(255) NOT NULL,
"sub_tasks" TEXT NOT NULL,
"count" INTEGER NOT NULL
);
-- Table: django_celery_results_groupresult
DROP TABLE IF EXISTS "django_celery_results_groupresult" CASCADE;
CREATE TABLE "django_celery_results_groupresult" (
"id" SERIAL,
"group_id" VARCHAR(255) NOT NULL,
"date_created" TIMESTAMP WITH TIME ZONE NOT NULL,
"date_done" TIMESTAMP WITH TIME ZONE NOT NULL,
"content_type" VARCHAR(128) NOT NULL,
"content_encoding" VARCHAR(64) NOT NULL,
"result" TEXT
);
-- Table: django_celery_results_taskresult
DROP TABLE IF EXISTS "django_celery_results_taskresult" CASCADE;
CREATE TABLE "django_celery_results_taskresult" (
"id" SERIAL,
"task_id" VARCHAR(255) NOT NULL,
"status" VARCHAR(50) NOT NULL,
"content_type" VARCHAR(128) NOT NULL,
"content_encoding" VARCHAR(64) NOT NULL,
"result" TEXT,
"date_done" TIMESTAMP WITH TIME ZONE NOT NULL,
"traceback" TEXT,
"meta" TEXT,
"task_args" TEXT,
"task_kwargs" TEXT,
"task_name" VARCHAR(255),
"worker" VARCHAR(100),
"date_created" TIMESTAMP WITH TIME ZONE NOT NULL,
"periodic_task_name" VARCHAR(255),
"date_started" TIMESTAMP WITH TIME ZONE
);
-- Table: django_content_type
DROP TABLE IF EXISTS "django_content_type" CASCADE;
CREATE TABLE "django_content_type" (
"id" SERIAL,
"app_label" VARCHAR(100) NOT NULL,
"model" VARCHAR(100) NOT NULL
);
-- Data for table: django_content_type
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (1, 'admin', 'logentry');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (2, 'auth', 'permission');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (3, 'auth', 'group');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (4, 'contenttypes', 'contenttype');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (5, 'sessions', 'session');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (6, 'social_django', 'association');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (7, 'social_django', 'code');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (8, 'social_django', 'nonce');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (9, 'social_django', 'usersocialauth');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (10, 'social_django', 'partial');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (11, 'django_celery_results', 'taskresult');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (12, 'django_celery_results', 'chordcounter');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (13, 'django_celery_results', 'groupresult');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (14, 'sites', 'site');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (15, 'accounts', 'customuser');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (16, 'blog', 'tags');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (17, 'blog', 'category');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (18, 'blog', 'post');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (19, 'blog', 'categoryview');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (20, 'blog', 'comment');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (21, 'backup', 'databasebackup');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (22, 'settings', 'banner');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (23, 'settings', 'setting');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (24, 'utils', 'jsontotype');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (25, 'image', 'postimages');
-- Table: django_migrations
DROP TABLE IF EXISTS "django_migrations" CASCADE;
CREATE TABLE "django_migrations" (
"id" BIGSERIAL,
"app" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"applied" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_migrations
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (1, 'contenttypes', '0001_initial', '2026-01-12T07:15:12.542418+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (2, 'contenttypes', '0002_remove_content_type_name', '2026-01-12T07:15:12.577999+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (3, 'auth', '0001_initial', '2026-01-12T07:15:12.702340+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (4, 'auth', '0002_alter_permission_name_max_length', '2026-01-12T07:15:12.723516+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (5, 'auth', '0003_alter_user_email_max_length', '2026-01-12T07:15:12.737686+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (6, 'auth', '0004_alter_user_username_opts', '2026-01-12T07:15:12.755728+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (7, 'auth', '0005_alter_user_last_login_null', '2026-01-12T07:15:12.773646+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (8, 'auth', '0006_require_contenttypes_0002', '2026-01-12T07:15:12.784387+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (9, 'auth', '0007_alter_validators_add_error_messages', '2026-01-12T07:15:12.801834+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (10, 'auth', '0008_alter_user_username_max_length', '2026-01-12T07:15:12.822500+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (11, 'auth', '0009_alter_user_last_name_max_length', '2026-01-12T07:15:12.948552+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (12, 'auth', '0010_alter_group_name_max_length', '2026-01-12T07:15:12.979395+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (13, 'auth', '0011_update_proxy_permissions', '2026-01-12T07:15:12.991361+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (14, 'auth', '0012_alter_user_first_name_max_length', '2026-01-12T07:15:13.006024+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (15, 'accounts', '0001_initial', '2026-01-12T07:15:13.160603+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (16, 'admin', '0001_initial', '2026-01-12T07:15:13.226104+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (17, 'admin', '0002_logentry_remove_auto_add', '2026-01-12T07:15:13.243791+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (18, 'admin', '0003_logentry_add_action_flag_choices', '2026-01-12T07:15:13.262814+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (19, 'backup', '0001_initial', '2026-01-12T07:15:13.321501+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (20, 'blog', '0001_initial', '2026-01-12T07:15:14.087778+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (21, 'blog', '0002_remove_comment_product_comment_post', '2026-01-12T07:15:14.258717+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (22, 'django_celery_results', '0001_initial', '2026-01-12T07:15:14.311609+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (23, 'django_celery_results', '0002_add_task_name_args_kwargs', '2026-01-12T07:15:14.346503+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (24, 'django_celery_results', '0003_auto_20181106_1101', '2026-01-12T07:15:14.358169+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (25, 'django_celery_results', '0004_auto_20190516_0412', '2026-01-12T07:15:14.426631+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (26, 'django_celery_results', '0005_taskresult_worker', '2026-01-12T07:15:14.458888+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (27, 'django_celery_results', '0006_taskresult_date_created', '2026-01-12T07:15:14.514074+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (28, 'django_celery_results', '0007_remove_taskresult_hidden', '2026-01-12T07:15:14.530647+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (29, 'django_celery_results', '0008_chordcounter', '2026-01-12T07:15:14.575349+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (30, 'django_celery_results', '0009_groupresult', '2026-01-12T07:15:14.838834+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (31, 'django_celery_results', '0010_remove_duplicate_indices', '2026-01-12T07:15:14.867897+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (32, 'django_celery_results', '0011_taskresult_periodic_task_name', '2026-01-12T07:15:14.884769+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (33, 'django_celery_results', '0012_taskresult_date_started', '2026-01-12T07:15:14.902053+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (34, 'django_celery_results', '0013_taskresult_django_cele_periodi_1993cf_idx', '2026-01-12T07:15:14.921276+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (35, 'django_celery_results', '0014_alter_taskresult_status', '2026-01-12T07:15:14.930947+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (36, 'image', '0001_initial', '2026-01-12T07:15:14.991057+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (37, 'image', '0002_rename_post_postimages', '2026-01-12T07:15:15.036764+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (38, 'image', '0003_postimages_user', '2026-01-12T07:15:15.141526+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (39, 'image', '0004_alter_postimages_options', '2026-01-12T07:15:15.159825+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (40, 'sessions', '0001_initial', '2026-01-12T07:15:15.214435+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (41, 'settings', '0001_initial', '2026-01-12T07:15:15.259589+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (42, 'sites', '0001_initial', '2026-01-12T07:15:15.288083+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (43, 'sites', '0002_alter_domain_unique', '2026-01-12T07:15:15.315012+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (44, 'default', '0001_initial', '2026-01-12T07:15:15.590869+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (45, 'social_auth', '0001_initial', '2026-01-12T07:15:15.595485+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (46, 'default', '0002_add_related_name', '2026-01-12T07:15:15.621437+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (47, 'social_auth', '0002_add_related_name', '2026-01-12T07:15:15.628944+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (48, 'default', '0003_alter_email_max_length', '2026-01-12T07:15:15.652502+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (49, 'social_auth', '0003_alter_email_max_length', '2026-01-12T07:15:15.655907+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (50, 'default', '0004_auto_20160423_0400', '2026-01-12T07:15:15.685906+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (51, 'social_auth', '0004_auto_20160423_0400', '2026-01-12T07:15:15.696546+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (52, 'social_auth', '0005_auto_20160727_2333', '2026-01-12T07:15:15.729349+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (53, 'social_django', '0006_partial', '2026-01-12T07:15:15.773666+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (54, 'social_django', '0007_code_timestamp', '2026-01-12T07:15:15.921446+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (55, 'social_django', '0008_partial_timestamp', '2026-01-12T07:15:15.953188+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (56, 'social_django', '0009_auto_20191118_0520', '2026-01-12T07:15:16.028372+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (57, 'social_django', '0010_uid_db_index', '2026-01-12T07:15:16.093575+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (58, 'social_django', '0011_alter_id_fields', '2026-01-12T07:15:16.452604+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (59, 'social_django', '0012_usersocialauth_extra_data_new', '2026-01-12T07:15:16.517085+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (60, 'social_django', '0013_migrate_extra_data', '2026-01-12T07:15:16.575953+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (61, 'social_django', '0014_remove_usersocialauth_extra_data', '2026-01-12T07:15:16.621255+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (62, 'social_django', '0015_rename_extra_data_new_usersocialauth_extra_data', '2026-01-12T07:15:16.656994+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (63, 'social_django', '0016_alter_usersocialauth_extra_data', '2026-01-12T07:15:16.789930+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (64, 'social_django', '0017_usersocialauth_user_social_auth_uid_required', '2026-01-12T07:15:16.827312+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (65, 'utils', '0001_initial', '2026-01-12T07:15:16.912384+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (66, 'utils', '0002_alter_jsontotype_json_data', '2026-01-12T07:15:16.955381+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (67, 'utils', '0003_alter_jsontotype_type_data', '2026-01-12T07:15:16.993888+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (68, 'social_django', '0002_add_related_name', '2026-01-12T07:15:17.006495+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (69, 'social_django', '0003_alter_email_max_length', '2026-01-12T07:15:17.014954+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (70, 'social_django', '0005_auto_20160727_2333', '2026-01-12T07:15:17.022004+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (71, 'social_django', '0004_auto_20160423_0400', '2026-01-12T07:15:17.026070+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (72, 'social_django', '0001_initial', '2026-01-12T07:15:17.029857+00:00'::timestamptz);
-- Table: django_session
DROP TABLE IF EXISTS "django_session" CASCADE;
CREATE TABLE "django_session" (
"session_key" VARCHAR(40) NOT NULL,
"session_data" TEXT NOT NULL,
"expire_date" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_session
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('9v6wn2risssnsguguvyp9biej830n5ir', '.eJxVjMsOwiAQRf-FtSGF8hhcuvcbyDADUjU0Ke3K-O_apAvd3nPOfYmI21rj1vMSJxZnocTpd0tIj9x2wHdst1nS3NZlSnJX5EG7vM6cn5fD_Tuo2Ou3dlQcaAOFaYDBevQFrfelJBMMJ529Bo2jdwRMABwIikvKuuDUqGwQ7w_pzjeh:1vfC9p:LBP6Zi9NBG_1yjpySQg18YhG_BSFcfHu3yaT4vJNzJE', '2026-01-26T07:16:09.151496+00:00'::timestamptz);
-- Table: django_site
DROP TABLE IF EXISTS "django_site" CASCADE;
CREATE TABLE "django_site" (
"id" SERIAL,
"domain" VARCHAR(100) NOT NULL,
"name" VARCHAR(50) NOT NULL
);
-- Data for table: django_site
INSERT INTO "django_site" ("id", "domain", "name") VALUES (1, 'example.com', 'example.com');
-- Table: images
DROP TABLE IF EXISTS "images" CASCADE;
CREATE TABLE "images" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"path" VARCHAR(254) NOT NULL,
"processed_path" VARCHAR(254) NOT NULL,
"original_filename" VARCHAR(254) NOT NULL,
"format" VARCHAR(254) NOT NULL,
"width" INTEGER NOT NULL,
"height" INTEGER NOT NULL,
"size" INTEGER NOT NULL,
"quality" INTEGER NOT NULL,
"slug" VARCHAR(250) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"is_front" BOOLEAN NOT NULL,
"user_id" BIGINT NOT NULL
);
-- Table: json_to_type
DROP TABLE IF EXISTS "json_to_type" CASCADE;
CREATE TABLE "json_to_type" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"json_data" JSONB NOT NULL,
"type_data" TEXT NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"user_id" BIGINT NOT NULL
);
-- Table: posts
DROP TABLE IF EXISTS "posts" CASCADE;
CREATE TABLE "posts" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"content" TEXT,
"keywords" VARCHAR(254) NOT NULL,
"image" VARCHAR(100),
"thumb" VARCHAR(100),
"video" VARCHAR(254),
"slug" VARCHAR(250) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"is_front" BOOLEAN NOT NULL,
"parent_id" BIGINT,
"user_id" BIGINT
);
-- Table: posts_categories
DROP TABLE IF EXISTS "posts_categories" CASCADE;
CREATE TABLE "posts_categories" (
"id" BIGSERIAL,
"post_id" BIGINT NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: posts_tags
DROP TABLE IF EXISTS "posts_tags" CASCADE;
CREATE TABLE "posts_tags" (
"id" BIGSERIAL,
"post_id" BIGINT NOT NULL,
"tags_id" BIGINT NOT NULL
);
-- Table: settings
DROP TABLE IF EXISTS "settings" CASCADE;
CREATE TABLE "settings" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"meta_title" VARCHAR(254) NOT NULL,
"meta_description" VARCHAR(254) NOT NULL,
"phone" VARCHAR(254) NOT NULL,
"url" VARCHAR(254),
"email" VARCHAR(254) NOT NULL,
"facebook" VARCHAR(254),
"x" VARCHAR(254),
"instagram" VARCHAR(254),
"whatsapp" VARCHAR(254),
"slogan" VARCHAR(254),
"w_logo" VARCHAR(100),
"b_logo" VARCHAR(100),
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Table: social_auth_association
DROP TABLE IF EXISTS "social_auth_association" CASCADE;
CREATE TABLE "social_auth_association" (
"id" BIGSERIAL,
"server_url" VARCHAR(255) NOT NULL,
"handle" VARCHAR(255) NOT NULL,
"secret" VARCHAR(255) NOT NULL,
"issued" INTEGER NOT NULL,
"lifetime" INTEGER NOT NULL,
"assoc_type" VARCHAR(64) NOT NULL
);
-- Table: social_auth_code
DROP TABLE IF EXISTS "social_auth_code" CASCADE;
CREATE TABLE "social_auth_code" (
"id" BIGSERIAL,
"email" VARCHAR(254) NOT NULL,
"code" VARCHAR(32) NOT NULL,
"verified" BOOLEAN NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: social_auth_nonce
DROP TABLE IF EXISTS "social_auth_nonce" CASCADE;
CREATE TABLE "social_auth_nonce" (
"id" BIGSERIAL,
"server_url" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL,
"salt" VARCHAR(65) NOT NULL
);
-- Table: social_auth_partial
DROP TABLE IF EXISTS "social_auth_partial" CASCADE;
CREATE TABLE "social_auth_partial" (
"id" BIGSERIAL,
"token" VARCHAR(32) NOT NULL,
"next_step" SMALLINT NOT NULL,
"backend" VARCHAR(32) NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL,
"data" JSONB NOT NULL
);
-- Table: social_auth_usersocialauth
DROP TABLE IF EXISTS "social_auth_usersocialauth" CASCADE;
CREATE TABLE "social_auth_usersocialauth" (
"id" BIGSERIAL,
"provider" VARCHAR(32) NOT NULL,
"uid" VARCHAR(255) NOT NULL,
"user_id" BIGINT NOT NULL,
"created" TIMESTAMP WITH TIME ZONE NOT NULL,
"modified" TIMESTAMP WITH TIME ZONE NOT NULL,
"extra_data" JSONB NOT NULL
);
-- Table: tags
DROP TABLE IF EXISTS "tags" CASCADE;
CREATE TABLE "tags" (
"id" BIGSERIAL,
"tag" VARCHAR(254) NOT NULL,
"slug" VARCHAR(250) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Reset sequences
SELECT setval('django_migrations_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_migrations"));
SELECT setval('django_content_type_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_content_type"));
SELECT setval('auth_permission_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_permission"));
SELECT setval('auth_group_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group"));
SELECT setval('auth_group_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group_permissions"));
SELECT setval('accounts_customuser_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser"));
SELECT setval('accounts_customuser_groups_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_groups"));
SELECT setval('accounts_customuser_user_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_user_permissions"));
SELECT setval('django_admin_log_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_admin_log"));
SELECT setval('backup_databasebackup_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "backup_databasebackup"));
SELECT setval('tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "tags"));
SELECT setval('categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "categories"));
SELECT setval('posts_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts"));
SELECT setval('posts_categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_categories"));
SELECT setval('posts_tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_tags"));
SELECT setval('category_views_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "category_views"));
SELECT setval('comments_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "comments"));
SELECT setval('django_celery_results_taskresult_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_results_taskresult"));
SELECT setval('django_celery_results_chordcounter_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_results_chordcounter"));
SELECT setval('django_celery_results_groupresult_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_results_groupresult"));
SELECT setval('images_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "images"));
SELECT setval('banners_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "banners"));
SELECT setval('settings_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "settings"));
SELECT setval('django_site_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_site"));
SELECT setval('social_auth_association_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_association"));
SELECT setval('social_auth_code_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_code"));
SELECT setval('social_auth_nonce_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_nonce"));
SELECT setval('social_auth_usersocialauth_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_usersocialauth"));
SELECT setval('social_auth_partial_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_partial"));
SELECT setval('json_to_type_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "json_to_type"));

View File

@@ -0,0 +1,694 @@
-- PostgreSQL Database Backup
-- Database: server_dj
-- Date: 2025-12-24 17:57:02.926153
-- Created by Django Backup System using psycopg2
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
-- Table: accounts_customuser
DROP TABLE IF EXISTS "accounts_customuser" CASCADE;
CREATE TABLE "accounts_customuser" (
"id" BIGINT NOT NULL,
"password" VARCHAR(128) NOT NULL,
"last_login" TIMESTAMP WITH TIME ZONE,
"is_superuser" BOOLEAN NOT NULL,
"email" VARCHAR(254) NOT NULL,
"first_name" VARCHAR(150) NOT NULL,
"last_name" VARCHAR(150) NOT NULL,
"is_staff" BOOLEAN NOT NULL,
"is_active" BOOLEAN NOT NULL,
"date_joined" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: accounts_customuser
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (2, 'pbkdf2_sha256$1000000$STRdTwcrx5Zp9jq1AJaBqA$FpygakERoretxVl2gmrcC9LRbfLmBksNXfPOHpUDQIc=', NULL, true, 'admin@example.com', '', '', true, true, '2025-12-23T17:00:07.461106+00:00'::timestamptz);
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (1, 'pbkdf2_sha256$1000000$TuAKB9bCikcDO3QDAzLoMP$yeBkHfoUF+KO5yczuWOAaOyJALWMFg+y8zXgsoXkGcY=', '2025-12-24T17:56:39.320008+00:00'::timestamptz, true, 'beyhan@beyhan.dev', '', '', true, true, '2025-12-22T17:00:19.382231+00:00'::timestamptz);
-- Table: accounts_customuser_groups
DROP TABLE IF EXISTS "accounts_customuser_groups" CASCADE;
CREATE TABLE "accounts_customuser_groups" (
"id" BIGINT NOT NULL,
"customuser_id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL
);
-- Table: accounts_customuser_user_permissions
DROP TABLE IF EXISTS "accounts_customuser_user_permissions" CASCADE;
CREATE TABLE "accounts_customuser_user_permissions" (
"id" BIGINT NOT NULL,
"customuser_id" BIGINT NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_group
DROP TABLE IF EXISTS "auth_group" CASCADE;
CREATE TABLE "auth_group" (
"id" INTEGER NOT NULL,
"name" VARCHAR(150) NOT NULL
);
-- Table: auth_group_permissions
DROP TABLE IF EXISTS "auth_group_permissions" CASCADE;
CREATE TABLE "auth_group_permissions" (
"id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_permission
DROP TABLE IF EXISTS "auth_permission" CASCADE;
CREATE TABLE "auth_permission" (
"id" INTEGER NOT NULL,
"name" VARCHAR(255) NOT NULL,
"content_type_id" INTEGER NOT NULL,
"codename" VARCHAR(100) NOT NULL
);
-- Data for table: auth_permission
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (1, 'Can add log entry', 1, 'add_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (2, 'Can change log entry', 1, 'change_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (3, 'Can delete log entry', 1, 'delete_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (4, 'Can view log entry', 1, 'view_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (5, 'Can add permission', 3, 'add_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (6, 'Can change permission', 3, 'change_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (7, 'Can delete permission', 3, 'delete_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (8, 'Can view permission', 3, 'view_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (9, 'Can add group', 2, 'add_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (10, 'Can change group', 2, 'change_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (11, 'Can delete group', 2, 'delete_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (12, 'Can view group', 2, 'view_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (13, 'Can add content type', 4, 'add_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (14, 'Can change content type', 4, 'change_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (15, 'Can delete content type', 4, 'delete_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (16, 'Can view content type', 4, 'view_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (17, 'Can add session', 5, 'add_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (18, 'Can change session', 5, 'change_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (19, 'Can delete session', 5, 'delete_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (20, 'Can view session', 5, 'view_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (21, 'Can add association', 6, 'add_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (22, 'Can change association', 6, 'change_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (23, 'Can delete association', 6, 'delete_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (24, 'Can view association', 6, 'view_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (25, 'Can add code', 7, 'add_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (26, 'Can change code', 7, 'change_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (27, 'Can delete code', 7, 'delete_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (28, 'Can view code', 7, 'view_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (29, 'Can add nonce', 8, 'add_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (30, 'Can change nonce', 8, 'change_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (31, 'Can delete nonce', 8, 'delete_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (32, 'Can view nonce', 8, 'view_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (33, 'Can add user social auth', 10, 'add_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (34, 'Can change user social auth', 10, 'change_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (35, 'Can delete user social auth', 10, 'delete_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (36, 'Can view user social auth', 10, 'view_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (37, 'Can add partial', 9, 'add_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (38, 'Can change partial', 9, 'change_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (39, 'Can delete partial', 9, 'delete_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (40, 'Can view partial', 9, 'view_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (41, 'Can add site', 11, 'add_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (42, 'Can change site', 11, 'change_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (43, 'Can delete site', 11, 'delete_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (44, 'Can view site', 11, 'view_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (45, 'Can add user', 12, 'add_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (46, 'Can change user', 12, 'change_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (47, 'Can delete user', 12, 'delete_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (48, 'Can view user', 12, 'view_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (49, 'Can add Banner', 13, 'add_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (50, 'Can change Banner', 13, 'change_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (51, 'Can delete Banner', 13, 'delete_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (52, 'Can view Banner', 13, 'view_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (53, 'Can add Site Ayarı', 14, 'add_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (54, 'Can change Site Ayarı', 14, 'change_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (55, 'Can delete Site Ayarı', 14, 'delete_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (56, 'Can view Site Ayarı', 14, 'view_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (57, 'Can add Post Tagı', 19, 'add_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (58, 'Can change Post Tagı', 19, 'change_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (59, 'Can delete Post Tagı', 19, 'delete_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (60, 'Can view Post Tagı', 19, 'view_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (61, 'Can add Post Kategori', 15, 'add_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (62, 'Can change Post Kategori', 15, 'change_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (63, 'Can delete Post Kategori', 15, 'delete_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (64, 'Can view Post Kategori', 15, 'view_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (65, 'Can add Post', 18, 'add_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (66, 'Can change Post', 18, 'change_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (67, 'Can delete Post', 18, 'delete_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (68, 'Can view Post', 18, 'view_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (69, 'Can add Kategori Ziyareti', 16, 'add_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (70, 'Can change Kategori Ziyareti', 16, 'change_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (71, 'Can delete Kategori Ziyareti', 16, 'delete_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (72, 'Can view Kategori Ziyareti', 16, 'view_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (73, 'Can add Post Yorum', 17, 'add_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (74, 'Can change Post Yorum', 17, 'change_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (75, 'Can delete Post Yorum', 17, 'delete_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (76, 'Can view Post Yorum', 17, 'view_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (77, 'Can add Veritabanı Yedeği', 20, 'add_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (78, 'Can change Veritabanı Yedeği', 20, 'change_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (79, 'Can delete Veritabanı Yedeği', 20, 'delete_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (80, 'Can view Veritabanı Yedeği', 20, 'view_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (81, 'Can add crontab', 21, 'add_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (82, 'Can change crontab', 21, 'change_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (83, 'Can delete crontab', 21, 'delete_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (84, 'Can view crontab', 21, 'view_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (85, 'Can add interval', 22, 'add_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (86, 'Can change interval', 22, 'change_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (87, 'Can delete interval', 22, 'delete_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (88, 'Can view interval', 22, 'view_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (89, 'Can add periodic task', 23, 'add_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (90, 'Can change periodic task', 23, 'change_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (91, 'Can delete periodic task', 23, 'delete_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (92, 'Can view periodic task', 23, 'view_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (93, 'Can add periodic task track', 24, 'add_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (94, 'Can change periodic task track', 24, 'change_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (95, 'Can delete periodic task track', 24, 'delete_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (96, 'Can view periodic task track', 24, 'view_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (97, 'Can add solar event', 25, 'add_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (98, 'Can change solar event', 25, 'change_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (99, 'Can delete solar event', 25, 'delete_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (100, 'Can view solar event', 25, 'view_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (101, 'Can add clocked', 26, 'add_clockedschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (102, 'Can change clocked', 26, 'change_clockedschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (103, 'Can delete clocked', 26, 'delete_clockedschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (104, 'Can view clocked', 26, 'view_clockedschedule');
-- Table: backup_databasebackup
DROP TABLE IF EXISTS "backup_databasebackup" CASCADE;
CREATE TABLE "backup_databasebackup" (
"id" BIGINT NOT NULL,
"name" VARCHAR(255) NOT NULL,
"file_path" VARCHAR(500),
"file_size" BIGINT,
"status" VARCHAR(20) NOT NULL,
"backup_type" VARCHAR(20) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"completed_at" TIMESTAMP WITH TIME ZONE,
"error_message" TEXT,
"notes" TEXT,
"created_by_id" BIGINT
);
-- Data for table: backup_databasebackup
INSERT INTO "backup_databasebackup" ("id", "name", "file_path", "file_size", "status", "backup_type", "created_at", "completed_at", "error_message", "notes", "created_by_id") VALUES (28, 'Manuel Yedek - 2025-12-24 17:57:02', NULL, NULL, 'in_progress', 'manual', '2025-12-24T17:57:02.880561+00:00'::timestamptz, NULL, NULL, NULL, 1);
-- Table: banners
DROP TABLE IF EXISTS "banners" CASCADE;
CREATE TABLE "banners" (
"id" BIGINT NOT NULL,
"color" VARCHAR(25) NOT NULL,
"title" VARCHAR(254),
"text1" VARCHAR(254),
"text2" VARCHAR(254),
"text4" VARCHAR(254),
"text5" VARCHAR(254),
"image" VARCHAR(100) NOT NULL,
"image_k" VARCHAR(100),
"image_k_txt" VARCHAR(254),
"is_active" BOOLEAN NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: categories
DROP TABLE IF EXISTS "categories" CASCADE;
CREATE TABLE "categories" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"keywords" VARCHAR(254) NOT NULL,
"description" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"order" INTEGER NOT NULL,
"slug" VARCHAR(250) NOT NULL,
"image" VARCHAR(100),
"parent_id" BIGINT
);
-- Table: category_views
DROP TABLE IF EXISTS "category_views" CASCADE;
CREATE TABLE "category_views" (
"id" BIGINT NOT NULL,
"ip_address" INET NOT NULL,
"user_agent" TEXT,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: comments
DROP TABLE IF EXISTS "comments" CASCADE;
CREATE TABLE "comments" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"body" TEXT NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"slug" VARCHAR(50) NOT NULL,
"parent_id" BIGINT,
"user_id" BIGINT NOT NULL,
"product_id" BIGINT NOT NULL
);
-- Table: django_admin_log
DROP TABLE IF EXISTS "django_admin_log" CASCADE;
CREATE TABLE "django_admin_log" (
"id" INTEGER NOT NULL,
"action_time" TIMESTAMP WITH TIME ZONE NOT NULL,
"object_id" TEXT,
"object_repr" VARCHAR(200) NOT NULL,
"action_flag" SMALLINT NOT NULL,
"change_message" TEXT NOT NULL,
"content_type_id" INTEGER,
"user_id" BIGINT NOT NULL
);
-- Data for table: django_admin_log
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (1, '2025-12-22T17:00:54.961166+00:00'::timestamptz, '1', 'Yedek 1 - Bekliyor', 1, '[{"added": {}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (2, '2025-12-22T17:01:10.019183+00:00'::timestamptz, '1', 'Yedek 1 - Bekliyor', 2, '[]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (3, '2025-12-22T17:08:18.352881+00:00'::timestamptz, '2', 'Manuel Yedek - 2025-12-22 17:01:15 - Başarısız', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (4, '2025-12-22T17:08:25.284922+00:00'::timestamptz, '4', 'Manuel Yedek - 2025-12-22 17:05:18 - Başarısız', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (5, '2025-12-22T17:08:30.992298+00:00'::timestamptz, '3', 'Manuel Yedek - 2025-12-22 17:03:41 - Başarısız', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (6, '2025-12-22T17:08:56.836202+00:00'::timestamptz, '5', 'Manuel Yedek - 2025-12-22 17:06:15 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (7, '2025-12-22T17:32:09.624013+00:00'::timestamptz, '7', 'Manuel Yedek - 2025-12-22 17:30:14 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (8, '2025-12-22T17:32:15.437591+00:00'::timestamptz, '6', 'Manuel Yedek - 2025-12-22 17:09:20 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (9, '2025-12-22T17:35:52.413394+00:00'::timestamptz, '8', 'Manuel Yedek - 2025-12-22 17:32:27 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (10, '2025-12-22T18:03:49.897584+00:00'::timestamptz, '13', 'Manuel Yedek - 2025-12-22 17:50:15 - Tamamlandı', 2, '[{"changed": {"fields": ["Yedek Tipi"]}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (11, '2025-12-22T18:08:37.961862+00:00'::timestamptz, '11', 'Manuel Yedek - 2025-12-22 17:38:03 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (12, '2025-12-22T18:08:57.986969+00:00'::timestamptz, '14', 'Manuel Yedek - 2025-12-22 18:07:38 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (13, '2025-12-22T18:09:03.531449+00:00'::timestamptz, '12', 'Manuel Yedek - 2025-12-22 17:43:28 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (14, '2025-12-22T18:09:17.538540+00:00'::timestamptz, '13', 'Manuel Yedek - 2025-12-22 17:50:15 - Tamamlandı', 2, '[{"changed": {"fields": ["Yedek Tipi"]}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (15, '2025-12-22T18:34:40.618018+00:00'::timestamptz, '16', 'Manuel Yedek - 2025-12-22 18:33:20 - Bekliyor', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (16, '2025-12-23T17:01:26.647467+00:00'::timestamptz, '18', 'Manuel Yedek - 2025-12-23 17:00:47 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (17, '2025-12-23T17:01:38.828269+00:00'::timestamptz, '17', 'Manuel Yedek - 2025-12-22 18:34:13 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (18, '2025-12-23T17:01:43.823658+00:00'::timestamptz, '15', 'Manuel Yedek - 2025-12-22 18:09:22 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (19, '2025-12-23T17:01:54.835538+00:00'::timestamptz, '13', 'Manuel Yedek - 2025-12-22 17:50:15 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (20, '2025-12-23T17:02:16.355915+00:00'::timestamptz, '19', 'Yedek Al - Bekliyor', 1, '[{"added": {}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (21, '2025-12-24T15:12:30.215650+00:00'::timestamptz, '20', 'Manuel Yedek - 2025-12-23 17:02:44 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (22, '2025-12-24T15:13:08.133128+00:00'::timestamptz, '21', 'Manuel Yedek - 2025-12-24 15:12:38 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (23, '2025-12-24T15:14:20.197452+00:00'::timestamptz, '22', 'Manuel Yedek - 2025-12-24 15:13:32 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (24, '2025-12-24T15:21:35.234189+00:00'::timestamptz, '23', 'Manuel Yedek - 2025-12-24 15:21:11 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (25, '2025-12-24T15:25:09.589932+00:00'::timestamptz, '19', 'Yedek Al - Bekliyor', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (26, '2025-12-24T17:56:51.486638+00:00'::timestamptz, '27', 'Yüklenen Yedek - backup_server_dj_20251224_152152_test - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (27, '2025-12-24T17:56:51.486802+00:00'::timestamptz, '26', 'Manuel Yedek - 2025-12-24 15:28:28 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (28, '2025-12-24T17:56:51.486909+00:00'::timestamptz, '25', 'Manuel Yedek - 2025-12-24 15:26:24 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (29, '2025-12-24T17:56:51.487012+00:00'::timestamptz, '24', 'Manuel Yedek - 2025-12-24 15:21:52 - Tamamlandı', 3, '', 20, 1);
-- Table: django_celery_beat_clockedschedule
DROP TABLE IF EXISTS "django_celery_beat_clockedschedule" CASCADE;
CREATE TABLE "django_celery_beat_clockedschedule" (
"id" INTEGER NOT NULL,
"clocked_time" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: django_celery_beat_crontabschedule
DROP TABLE IF EXISTS "django_celery_beat_crontabschedule" CASCADE;
CREATE TABLE "django_celery_beat_crontabschedule" (
"id" INTEGER NOT NULL,
"minute" VARCHAR(240) NOT NULL,
"hour" VARCHAR(96) NOT NULL,
"day_of_week" VARCHAR(64) NOT NULL,
"day_of_month" VARCHAR(124) NOT NULL,
"month_of_year" VARCHAR(64) NOT NULL,
"timezone" VARCHAR(63) NOT NULL
);
-- Table: django_celery_beat_intervalschedule
DROP TABLE IF EXISTS "django_celery_beat_intervalschedule" CASCADE;
CREATE TABLE "django_celery_beat_intervalschedule" (
"id" INTEGER NOT NULL,
"every" INTEGER NOT NULL,
"period" VARCHAR(24) NOT NULL
);
-- Table: django_celery_beat_periodictask
DROP TABLE IF EXISTS "django_celery_beat_periodictask" CASCADE;
CREATE TABLE "django_celery_beat_periodictask" (
"id" INTEGER NOT NULL,
"name" VARCHAR(200) NOT NULL,
"task" VARCHAR(200) NOT NULL,
"args" TEXT NOT NULL,
"kwargs" TEXT NOT NULL,
"queue" VARCHAR(200),
"exchange" VARCHAR(200),
"routing_key" VARCHAR(200),
"expires" TIMESTAMP WITH TIME ZONE,
"enabled" BOOLEAN NOT NULL,
"last_run_at" TIMESTAMP WITH TIME ZONE,
"total_run_count" INTEGER NOT NULL,
"date_changed" TIMESTAMP WITH TIME ZONE NOT NULL,
"description" TEXT NOT NULL,
"crontab_id" INTEGER,
"interval_id" INTEGER,
"solar_id" INTEGER,
"one_off" BOOLEAN NOT NULL,
"start_time" TIMESTAMP WITH TIME ZONE,
"priority" INTEGER,
"headers" TEXT NOT NULL,
"clocked_id" INTEGER,
"expire_seconds" INTEGER
);
-- Table: django_celery_beat_periodictasks
DROP TABLE IF EXISTS "django_celery_beat_periodictasks" CASCADE;
CREATE TABLE "django_celery_beat_periodictasks" (
"ident" SMALLINT NOT NULL,
"last_update" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: django_celery_beat_solarschedule
DROP TABLE IF EXISTS "django_celery_beat_solarschedule" CASCADE;
CREATE TABLE "django_celery_beat_solarschedule" (
"id" INTEGER NOT NULL,
"event" VARCHAR(24) NOT NULL,
"latitude" NUMERIC NOT NULL,
"longitude" NUMERIC NOT NULL
);
-- Table: django_content_type
DROP TABLE IF EXISTS "django_content_type" CASCADE;
CREATE TABLE "django_content_type" (
"id" INTEGER NOT NULL,
"app_label" VARCHAR(100) NOT NULL,
"model" VARCHAR(100) NOT NULL
);
-- Data for table: django_content_type
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (1, 'admin', 'logentry');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (2, 'auth', 'group');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (3, 'auth', 'permission');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (4, 'contenttypes', 'contenttype');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (5, 'sessions', 'session');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (6, 'social_django', 'association');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (7, 'social_django', 'code');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (8, 'social_django', 'nonce');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (9, 'social_django', 'partial');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (10, 'social_django', 'usersocialauth');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (11, 'sites', 'site');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (12, 'accounts', 'customuser');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (13, 'settings', 'banner');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (14, 'settings', 'setting');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (15, 'blog', 'category');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (16, 'blog', 'categoryview');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (17, 'blog', 'comment');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (18, 'blog', 'post');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (19, 'blog', 'tags');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (20, 'backup', 'databasebackup');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (21, 'django_celery_beat', 'crontabschedule');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (22, 'django_celery_beat', 'intervalschedule');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (23, 'django_celery_beat', 'periodictask');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (24, 'django_celery_beat', 'periodictasks');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (25, 'django_celery_beat', 'solarschedule');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (26, 'django_celery_beat', 'clockedschedule');
-- Table: django_migrations
DROP TABLE IF EXISTS "django_migrations" CASCADE;
CREATE TABLE "django_migrations" (
"id" BIGINT NOT NULL,
"app" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"applied" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_migrations
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (1, 'contenttypes', '0001_initial', '2025-12-22T16:57:19.217932+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (2, 'contenttypes', '0002_remove_content_type_name', '2025-12-22T16:57:19.234555+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (3, 'auth', '0001_initial', '2025-12-22T16:57:19.434147+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (4, 'auth', '0002_alter_permission_name_max_length', '2025-12-22T16:57:19.446206+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (5, 'auth', '0003_alter_user_email_max_length', '2025-12-22T16:57:19.455809+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (6, 'auth', '0004_alter_user_username_opts', '2025-12-22T16:57:19.465593+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (7, 'auth', '0005_alter_user_last_login_null', '2025-12-22T16:57:19.475691+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (8, 'auth', '0006_require_contenttypes_0002', '2025-12-22T16:57:19.481434+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (9, 'auth', '0007_alter_validators_add_error_messages', '2025-12-22T16:57:19.565856+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (10, 'auth', '0008_alter_user_username_max_length', '2025-12-22T16:57:19.592172+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (11, 'auth', '0009_alter_user_last_name_max_length', '2025-12-22T16:57:19.603096+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (12, 'auth', '0010_alter_group_name_max_length', '2025-12-22T16:57:19.625591+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (13, 'auth', '0011_update_proxy_permissions', '2025-12-22T16:57:19.634914+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (14, 'auth', '0012_alter_user_first_name_max_length', '2025-12-22T16:57:19.645268+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (15, 'accounts', '0001_initial', '2025-12-22T16:57:19.898703+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (16, 'admin', '0001_initial', '2025-12-22T16:57:19.967758+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (17, 'admin', '0002_logentry_remove_auto_add', '2025-12-22T16:57:19.980668+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (18, 'admin', '0003_logentry_add_action_flag_choices', '2025-12-22T16:57:19.994932+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (19, 'backup', '0001_initial', '2025-12-22T16:57:20.047172+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (20, 'blog', '0001_initial', '2025-12-22T16:57:20.451373+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (21, 'sessions', '0001_initial', '2025-12-22T16:57:20.596961+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (22, 'settings', '0001_initial', '2025-12-22T16:57:20.623314+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (23, 'sites', '0001_initial', '2025-12-22T16:57:20.634939+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (24, 'sites', '0002_alter_domain_unique', '2025-12-22T16:57:20.648215+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (25, 'default', '0001_initial', '2025-12-22T16:57:20.743912+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (26, 'social_auth', '0001_initial', '2025-12-22T16:57:20.747238+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (27, 'social_django', '0001_initial', '2025-12-22T16:57:20.750337+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (28, 'default', '0002_add_related_name', '2025-12-22T16:57:20.772416+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (29, 'social_auth', '0002_add_related_name', '2025-12-22T16:57:20.776564+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (30, 'social_django', '0002_add_related_name', '2025-12-22T16:57:20.778681+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (31, 'default', '0003_alter_email_max_length', '2025-12-22T16:57:20.797950+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (32, 'social_auth', '0003_alter_email_max_length', '2025-12-22T16:57:20.800526+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (33, 'social_django', '0003_alter_email_max_length', '2025-12-22T16:57:20.802697+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (34, 'default', '0004_auto_20160423_0400', '2025-12-22T16:57:20.818189+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (35, 'social_auth', '0004_auto_20160423_0400', '2025-12-22T16:57:20.821978+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (36, 'social_django', '0004_auto_20160423_0400', '2025-12-22T16:57:20.824686+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (37, 'social_auth', '0005_auto_20160727_2333', '2025-12-22T16:57:20.838781+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (38, 'social_django', '0005_auto_20160727_2333', '2025-12-22T16:57:20.842005+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (39, 'social_django', '0006_partial', '2025-12-22T16:57:20.882162+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (40, 'social_django', '0007_code_timestamp', '2025-12-22T16:57:21.016558+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (41, 'social_django', '0008_partial_timestamp', '2025-12-22T16:57:21.036847+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (42, 'social_django', '0009_auto_20191118_0520', '2025-12-22T16:57:21.078912+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (43, 'social_django', '0010_uid_db_index', '2025-12-22T16:57:21.103380+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (44, 'social_django', '0011_alter_id_fields', '2025-12-22T16:57:21.271476+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (45, 'social_django', '0012_usersocialauth_extra_data_new', '2025-12-22T16:57:21.315237+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (46, 'social_django', '0013_migrate_extra_data', '2025-12-22T16:57:21.359048+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (47, 'social_django', '0014_remove_usersocialauth_extra_data', '2025-12-22T16:57:21.387186+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (48, 'social_django', '0015_rename_extra_data_new_usersocialauth_extra_data', '2025-12-22T16:57:21.411254+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (49, 'social_django', '0016_alter_usersocialauth_extra_data', '2025-12-22T16:57:21.425493+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (50, 'social_django', '0017_usersocialauth_user_social_auth_uid_required', '2025-12-22T16:57:21.447520+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (51, 'django_celery_beat', '0001_initial', '2025-12-22T17:29:12.618773+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (52, 'django_celery_beat', '0002_auto_20161118_0346', '2025-12-22T17:29:12.644272+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (53, 'django_celery_beat', '0003_auto_20161209_0049', '2025-12-22T17:29:12.661945+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (54, 'django_celery_beat', '0004_auto_20170221_0000', '2025-12-22T17:29:12.669274+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (55, 'django_celery_beat', '0005_add_solarschedule_events_choices', '2025-12-22T17:29:12.678019+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (56, 'django_celery_beat', '0006_auto_20180322_0932', '2025-12-22T17:29:12.752211+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (57, 'django_celery_beat', '0007_auto_20180521_0826', '2025-12-22T17:29:12.793017+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (58, 'django_celery_beat', '0008_auto_20180914_1922', '2025-12-22T17:29:12.831420+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (59, 'django_celery_beat', '0006_auto_20180210_1226', '2025-12-22T17:29:12.856887+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (60, 'django_celery_beat', '0006_periodictask_priority', '2025-12-22T17:29:12.877901+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (61, 'django_celery_beat', '0009_periodictask_headers', '2025-12-22T17:29:12.902729+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (62, 'django_celery_beat', '0010_auto_20190429_0326', '2025-12-22T17:29:13.109071+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (63, 'django_celery_beat', '0011_auto_20190508_0153', '2025-12-22T17:29:13.153527+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (64, 'django_celery_beat', '0012_periodictask_expire_seconds', '2025-12-22T17:29:13.170247+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (65, 'django_celery_beat', '0013_auto_20200609_0727', '2025-12-22T17:29:13.182913+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (66, 'django_celery_beat', '0014_remove_clockedschedule_enabled', '2025-12-22T17:29:13.197676+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (67, 'django_celery_beat', '0015_edit_solarschedule_events_choices', '2025-12-22T17:29:13.207482+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (68, 'django_celery_beat', '0016_alter_crontabschedule_timezone', '2025-12-22T17:29:13.224397+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (69, 'django_celery_beat', '0017_alter_crontabschedule_month_of_year', '2025-12-22T17:29:13.238625+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (70, 'django_celery_beat', '0018_improve_crontab_helptext', '2025-12-22T17:29:13.252445+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (71, 'django_celery_beat', '0019_alter_periodictasks_options', '2025-12-22T17:29:13.259425+00:00'::timestamptz);
-- Table: django_session
DROP TABLE IF EXISTS "django_session" CASCADE;
CREATE TABLE "django_session" (
"session_key" VARCHAR(40) NOT NULL,
"session_data" TEXT NOT NULL,
"expire_date" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_session
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('e7jyr13wedmqdkjukqb35t2pyylkbvwz', '.eJxVjEEOwiAQRe_C2hBgpKBL9z0DmWFGqRpISrsy3l2bdKHb_977L5VwXUpau8xpYnVWVh1-N8L8kLoBvmO9NZ1bXeaJ9KbonXY9NpbnZXf_Dgr28q0F0bKTEGNG70Uie8vgLbGBYxQbwBHlwQ0szoILOQsDwMmZeKVgvHp_APiKN_E:1vXjGo:c9NPOwqzmQXV6RsDHkclP-w4ogI8VDPbV0KQilsiW6Y', '2026-01-05T17:00:30.494599+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('thlq90xyxsfsbjaps7tlga1dnluq990o', '.eJxVjDsOwjAQBe_iGllr2PhDSZ8zWOtdBweQI8VJhbg7iZQC2pl5760irUuJa8tzHEVdlVGnX5aIn7nuQh5U75PmqS7zmPSe6MM23U-SX7ej_Tso1Mq2JnSIDJkGAugMIzln_AbBnhFckMA8UELxRB7RYLCA4tgG6QT4oj5f0K43Zw:1vY5kS:rh1Px0710ffBgpJaxxgDsDyvhjpMKdKLRmAxhKHJuqg', '2026-01-06T17:00:36.697289+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('xgwdpmw5guv7ygdfh5hn8s7njr1m8q54', '.eJxVjDsOwjAQBe_iGllr2PhDSZ8zWOtdBweQI8VJhbg7iZQC2pl5760irUuJa8tzHEVdlVGnX5aIn7nuQh5U75PmqS7zmPSe6MM23U-SX7ej_Tso1Mq2JnSIDJkGAugMIzln_AbBnhFckMA8UELxRB7RYLCA4tgG6QT4oj5f0K43Zw:1vYQXF:plw9RHnEzpCK5mUlnVbLTCLYkvx4NS29nPXM1OQT6yE', '2026-01-07T15:12:21.391215+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('8f1g3xhmdt9xwwyvlo3ozn57680zvlot', '.eJxVjDsOwjAQBe_iGllr2PhDSZ8zWOtdBweQI8VJhbg7iZQC2pl5760irUuJa8tzHEVdlVGnX5aIn7nuQh5U75PmqS7zmPSe6MM23U-SX7ej_Tso1Mq2JnSIDJkGAugMIzln_AbBnhFckMA8UELxRB7RYLCA4tgG6QT4oj5f0K43Zw:1vYT6F:5kBYD8TaD8dIBBcU6UwIVZCYGUwgGCe4IjA1ruLwbrw', '2026-01-07T17:56:39.326481+00:00'::timestamptz);
-- Table: django_site
DROP TABLE IF EXISTS "django_site" CASCADE;
CREATE TABLE "django_site" (
"id" INTEGER NOT NULL,
"domain" VARCHAR(100) NOT NULL,
"name" VARCHAR(50) NOT NULL
);
-- Data for table: django_site
INSERT INTO "django_site" ("id", "domain", "name") VALUES (1, 'example.com', 'example.com');
-- Table: posts
DROP TABLE IF EXISTS "posts" CASCADE;
CREATE TABLE "posts" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"content" TEXT,
"keywords" VARCHAR(254) NOT NULL,
"image" VARCHAR(100),
"video" VARCHAR(254),
"slug" VARCHAR(250) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"is_front" BOOLEAN NOT NULL,
"parent_id" BIGINT
);
-- Table: posts_categories
DROP TABLE IF EXISTS "posts_categories" CASCADE;
CREATE TABLE "posts_categories" (
"id" BIGINT NOT NULL,
"post_id" BIGINT NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: posts_tags
DROP TABLE IF EXISTS "posts_tags" CASCADE;
CREATE TABLE "posts_tags" (
"id" BIGINT NOT NULL,
"post_id" BIGINT NOT NULL,
"tags_id" BIGINT NOT NULL
);
-- Table: settings
DROP TABLE IF EXISTS "settings" CASCADE;
CREATE TABLE "settings" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"meta_title" VARCHAR(254) NOT NULL,
"meta_description" VARCHAR(254) NOT NULL,
"phone" VARCHAR(254) NOT NULL,
"url" VARCHAR(254),
"email" VARCHAR(254) NOT NULL,
"facebook" VARCHAR(254),
"x" VARCHAR(254),
"instagram" VARCHAR(254),
"whatsapp" VARCHAR(254),
"slogan" VARCHAR(254),
"w_logo" VARCHAR(100),
"b_logo" VARCHAR(100),
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Table: social_auth_association
DROP TABLE IF EXISTS "social_auth_association" CASCADE;
CREATE TABLE "social_auth_association" (
"id" BIGINT NOT NULL,
"server_url" VARCHAR(255) NOT NULL,
"handle" VARCHAR(255) NOT NULL,
"secret" VARCHAR(255) NOT NULL,
"issued" INTEGER NOT NULL,
"lifetime" INTEGER NOT NULL,
"assoc_type" VARCHAR(64) NOT NULL
);
-- Table: social_auth_code
DROP TABLE IF EXISTS "social_auth_code" CASCADE;
CREATE TABLE "social_auth_code" (
"id" BIGINT NOT NULL,
"email" VARCHAR(254) NOT NULL,
"code" VARCHAR(32) NOT NULL,
"verified" BOOLEAN NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: social_auth_nonce
DROP TABLE IF EXISTS "social_auth_nonce" CASCADE;
CREATE TABLE "social_auth_nonce" (
"id" BIGINT NOT NULL,
"server_url" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL,
"salt" VARCHAR(65) NOT NULL
);
-- Table: social_auth_partial
DROP TABLE IF EXISTS "social_auth_partial" CASCADE;
CREATE TABLE "social_auth_partial" (
"id" BIGINT NOT NULL,
"token" VARCHAR(32) NOT NULL,
"next_step" SMALLINT NOT NULL,
"backend" VARCHAR(32) NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL,
"data" JSONB NOT NULL
);
-- Table: social_auth_usersocialauth
DROP TABLE IF EXISTS "social_auth_usersocialauth" CASCADE;
CREATE TABLE "social_auth_usersocialauth" (
"id" BIGINT NOT NULL,
"provider" VARCHAR(32) NOT NULL,
"uid" VARCHAR(255) NOT NULL,
"user_id" BIGINT NOT NULL,
"created" TIMESTAMP WITH TIME ZONE NOT NULL,
"modified" TIMESTAMP WITH TIME ZONE NOT NULL,
"extra_data" JSONB NOT NULL
);
-- Table: tags
DROP TABLE IF EXISTS "tags" CASCADE;
CREATE TABLE "tags" (
"id" BIGINT NOT NULL,
"tag" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Reset sequences
SELECT setval('django_migrations_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_migrations"));
SELECT setval('django_content_type_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_content_type"));
SELECT setval('auth_permission_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_permission"));
SELECT setval('auth_group_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group"));
SELECT setval('auth_group_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group_permissions"));
SELECT setval('accounts_customuser_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser"));
SELECT setval('accounts_customuser_groups_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_groups"));
SELECT setval('accounts_customuser_user_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_user_permissions"));
SELECT setval('django_admin_log_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_admin_log"));
SELECT setval('backup_databasebackup_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "backup_databasebackup"));
SELECT setval('tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "tags"));
SELECT setval('categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "categories"));
SELECT setval('posts_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts"));
SELECT setval('posts_categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_categories"));
SELECT setval('posts_tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_tags"));
SELECT setval('category_views_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "category_views"));
SELECT setval('comments_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "comments"));
SELECT setval('banners_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "banners"));
SELECT setval('settings_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "settings"));
SELECT setval('django_site_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_site"));
SELECT setval('social_auth_association_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_association"));
SELECT setval('social_auth_code_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_code"));
SELECT setval('social_auth_nonce_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_nonce"));
SELECT setval('social_auth_usersocialauth_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_usersocialauth"));
SELECT setval('social_auth_partial_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_partial"));
SELECT setval('django_celery_beat_crontabschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_crontabschedule"));
SELECT setval('django_celery_beat_intervalschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_intervalschedule"));
SELECT setval('django_celery_beat_periodictask_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_periodictask"));
SELECT setval('django_celery_beat_solarschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_solarschedule"));
SELECT setval('django_celery_beat_clockedschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_clockedschedule"));

View File

@@ -0,0 +1,740 @@
-- PostgreSQL Database Backup
-- Database: server_dj
-- Date: 2026-01-03 00:03:26.147138
-- Created by Django Backup System using psycopg2
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
-- Table: accounts_customuser
DROP TABLE IF EXISTS "accounts_customuser" CASCADE;
CREATE TABLE "accounts_customuser" (
"id" BIGSERIAL,
"password" VARCHAR(128) NOT NULL,
"last_login" TIMESTAMP WITH TIME ZONE,
"is_superuser" BOOLEAN NOT NULL,
"email" VARCHAR(254) NOT NULL,
"first_name" VARCHAR(150) NOT NULL,
"last_name" VARCHAR(150) NOT NULL,
"is_staff" BOOLEAN NOT NULL,
"is_active" BOOLEAN NOT NULL,
"date_joined" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: accounts_customuser
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (1, 'pbkdf2_sha256$1000000$WplM35argbILEm9XB766gV$NslaYI4KLBSQi4x3OcJHTU5znmKBbeTqQWv0FM46UXc=', NULL, true, 'admin@example.com', '', '', true, true, '2025-12-30T18:17:13.754386+00:00'::timestamptz);
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (2, 'pbkdf2_sha256$1000000$KWo73NKEPK7ASp4DScmL8g$qxFFzxuOEhW3AS3lbJvXssxZv+n3G/tHZh5e3uoHNPc=', '2026-01-02T05:08:11.472584+00:00'::timestamptz, true, 'beyhan@beyhan.dev', '', '', true, true, '2025-12-30T18:53:28.829042+00:00'::timestamptz);
-- Table: accounts_customuser_groups
DROP TABLE IF EXISTS "accounts_customuser_groups" CASCADE;
CREATE TABLE "accounts_customuser_groups" (
"id" BIGSERIAL,
"customuser_id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL
);
-- Table: accounts_customuser_user_permissions
DROP TABLE IF EXISTS "accounts_customuser_user_permissions" CASCADE;
CREATE TABLE "accounts_customuser_user_permissions" (
"id" BIGSERIAL,
"customuser_id" BIGINT NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_group
DROP TABLE IF EXISTS "auth_group" CASCADE;
CREATE TABLE "auth_group" (
"id" SERIAL,
"name" VARCHAR(150) NOT NULL
);
-- Table: auth_group_permissions
DROP TABLE IF EXISTS "auth_group_permissions" CASCADE;
CREATE TABLE "auth_group_permissions" (
"id" BIGSERIAL,
"group_id" INTEGER NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_permission
DROP TABLE IF EXISTS "auth_permission" CASCADE;
CREATE TABLE "auth_permission" (
"id" SERIAL,
"name" VARCHAR(255) NOT NULL,
"content_type_id" INTEGER NOT NULL,
"codename" VARCHAR(100) NOT NULL
);
-- Data for table: auth_permission
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (1, 'Can add log entry', 1, 'add_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (2, 'Can change log entry', 1, 'change_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (3, 'Can delete log entry', 1, 'delete_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (4, 'Can view log entry', 1, 'view_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (5, 'Can add permission', 2, 'add_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (6, 'Can change permission', 2, 'change_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (7, 'Can delete permission', 2, 'delete_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (8, 'Can view permission', 2, 'view_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (9, 'Can add group', 3, 'add_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (10, 'Can change group', 3, 'change_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (11, 'Can delete group', 3, 'delete_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (12, 'Can view group', 3, 'view_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (13, 'Can add content type', 4, 'add_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (14, 'Can change content type', 4, 'change_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (15, 'Can delete content type', 4, 'delete_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (16, 'Can view content type', 4, 'view_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (17, 'Can add session', 5, 'add_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (18, 'Can change session', 5, 'change_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (19, 'Can delete session', 5, 'delete_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (20, 'Can view session', 5, 'view_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (21, 'Can add association', 6, 'add_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (22, 'Can change association', 6, 'change_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (23, 'Can delete association', 6, 'delete_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (24, 'Can view association', 6, 'view_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (25, 'Can add code', 7, 'add_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (26, 'Can change code', 7, 'change_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (27, 'Can delete code', 7, 'delete_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (28, 'Can view code', 7, 'view_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (29, 'Can add nonce', 8, 'add_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (30, 'Can change nonce', 8, 'change_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (31, 'Can delete nonce', 8, 'delete_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (32, 'Can view nonce', 8, 'view_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (33, 'Can add user social auth', 9, 'add_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (34, 'Can change user social auth', 9, 'change_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (35, 'Can delete user social auth', 9, 'delete_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (36, 'Can view user social auth', 9, 'view_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (37, 'Can add partial', 10, 'add_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (38, 'Can change partial', 10, 'change_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (39, 'Can delete partial', 10, 'delete_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (40, 'Can view partial', 10, 'view_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (41, 'Can add site', 11, 'add_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (42, 'Can change site', 11, 'change_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (43, 'Can delete site', 11, 'delete_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (44, 'Can view site', 11, 'view_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (45, 'Can add user', 12, 'add_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (46, 'Can change user', 12, 'change_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (47, 'Can delete user', 12, 'delete_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (48, 'Can view user', 12, 'view_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (49, 'Can add Post Tagı', 13, 'add_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (50, 'Can change Post Tagı', 13, 'change_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (51, 'Can delete Post Tagı', 13, 'delete_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (52, 'Can view Post Tagı', 13, 'view_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (53, 'Can add Post Kategori', 14, 'add_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (54, 'Can change Post Kategori', 14, 'change_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (55, 'Can delete Post Kategori', 14, 'delete_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (56, 'Can view Post Kategori', 14, 'view_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (57, 'Can add Post', 15, 'add_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (58, 'Can change Post', 15, 'change_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (59, 'Can delete Post', 15, 'delete_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (60, 'Can view Post', 15, 'view_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (61, 'Can add Kategori Ziyareti', 16, 'add_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (62, 'Can change Kategori Ziyareti', 16, 'change_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (63, 'Can delete Kategori Ziyareti', 16, 'delete_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (64, 'Can view Kategori Ziyareti', 16, 'view_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (65, 'Can add Post Yorum', 17, 'add_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (66, 'Can change Post Yorum', 17, 'change_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (67, 'Can delete Post Yorum', 17, 'delete_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (68, 'Can view Post Yorum', 17, 'view_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (69, 'Can add Veritabanı Yedeği', 18, 'add_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (70, 'Can change Veritabanı Yedeği', 18, 'change_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (71, 'Can delete Veritabanı Yedeği', 18, 'delete_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (72, 'Can view Veritabanı Yedeği', 18, 'view_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (73, 'Can add Banner', 19, 'add_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (74, 'Can change Banner', 19, 'change_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (75, 'Can delete Banner', 19, 'delete_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (76, 'Can view Banner', 19, 'view_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (77, 'Can add Site Ayarı', 20, 'add_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (78, 'Can change Site Ayarı', 20, 'change_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (79, 'Can delete Site Ayarı', 20, 'delete_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (80, 'Can view Site Ayarı', 20, 'view_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (81, 'Can add Json To Type', 21, 'add_jsontotype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (82, 'Can change Json To Type', 21, 'change_jsontotype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (83, 'Can delete Json To Type', 21, 'delete_jsontotype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (84, 'Can view Json To Type', 21, 'view_jsontotype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (85, 'Can add Post', 22, 'add_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (86, 'Can change Post', 22, 'change_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (87, 'Can delete Post', 22, 'delete_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (88, 'Can view Post', 22, 'view_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (89, 'Can add Post', 22, 'add_postimages');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (90, 'Can change Post', 22, 'change_postimages');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (91, 'Can delete Post', 22, 'delete_postimages');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (92, 'Can view Post', 22, 'view_postimages');
-- Table: backup_databasebackup
DROP TABLE IF EXISTS "backup_databasebackup" CASCADE;
CREATE TABLE "backup_databasebackup" (
"id" BIGSERIAL,
"name" VARCHAR(255) NOT NULL,
"file_path" VARCHAR(500),
"file_size" BIGINT,
"status" VARCHAR(20) NOT NULL,
"backup_type" VARCHAR(20) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"completed_at" TIMESTAMP WITH TIME ZONE,
"error_message" TEXT,
"notes" TEXT,
"created_by_id" BIGINT
);
-- Data for table: backup_databasebackup
INSERT INTO "backup_databasebackup" ("id", "name", "file_path", "file_size", "status", "backup_type", "created_at", "completed_at", "error_message", "notes", "created_by_id") VALUES (1, 'Manuel Yedek - 2025-12-30 20:48:48', 'C:\Sites\dj52\backups\backup_server_dj_20251230_124848.sql', 38279, 'completed', 'manual', '2025-12-30T20:48:48.445516+00:00'::timestamptz, '2025-12-30T20:48:49.475591+00:00'::timestamptz, NULL, NULL, 2);
INSERT INTO "backup_databasebackup" ("id", "name", "file_path", "file_size", "status", "backup_type", "created_at", "completed_at", "error_message", "notes", "created_by_id") VALUES (2, 'Manuel Yedek - 2026-01-02 19:21:00', 'C:\Sites\dj52\backups\backup_server_dj_20260102_112100.sql', 63942, 'completed', 'manual', '2026-01-02T19:21:00.851633+00:00'::timestamptz, '2026-01-02T19:21:02.355985+00:00'::timestamptz, NULL, NULL, 2);
INSERT INTO "backup_databasebackup" ("id", "name", "file_path", "file_size", "status", "backup_type", "created_at", "completed_at", "error_message", "notes", "created_by_id") VALUES (3, 'Manuel Yedek - 2026-01-03 00:03:25', NULL, NULL, 'in_progress', 'manual', '2026-01-03T00:03:25.980164+00:00'::timestamptz, NULL, NULL, NULL, 2);
-- Table: banners
DROP TABLE IF EXISTS "banners" CASCADE;
CREATE TABLE "banners" (
"id" BIGSERIAL,
"color" VARCHAR(25) NOT NULL,
"title" VARCHAR(254),
"text1" VARCHAR(254),
"text2" VARCHAR(254),
"text4" VARCHAR(254),
"text5" VARCHAR(254),
"image" VARCHAR(100) NOT NULL,
"image_k" VARCHAR(100),
"image_k_txt" VARCHAR(254),
"is_active" BOOLEAN NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: categories
DROP TABLE IF EXISTS "categories" CASCADE;
CREATE TABLE "categories" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"keywords" VARCHAR(254) NOT NULL,
"description" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"order" INTEGER NOT NULL,
"slug" VARCHAR(250) NOT NULL,
"image" VARCHAR(100),
"parent_id" BIGINT
);
-- Data for table: categories
INSERT INTO "categories" ("id", "title", "keywords", "description", "created_at", "updated_at", "is_active", "order", "slug", "image", "parent_id") VALUES (1, 'Linux', 'resd', 'dfd', '2026-01-02T23:29:40.546955+00:00'::timestamptz, '2026-01-02T23:29:40.546971+00:00'::timestamptz, true, 1, 'linux', '', NULL);
INSERT INTO "categories" ("id", "title", "keywords", "description", "created_at", "updated_at", "is_active", "order", "slug", "image", "parent_id") VALUES (2, 'Ubuntu', 'Ubuntu', 'Ubuntu', '2026-01-02T23:58:01.774338+00:00'::timestamptz, '2026-01-02T23:58:01.774421+00:00'::timestamptz, true, 1, 'ubuntu', '', 1);
INSERT INTO "categories" ("id", "title", "keywords", "description", "created_at", "updated_at", "is_active", "order", "slug", "image", "parent_id") VALUES (3, 'Debian', 'Debian', 'Debian', '2026-01-02T23:59:00.523219+00:00'::timestamptz, '2026-01-02T23:59:00.523243+00:00'::timestamptz, true, 1, 'debian', '', 1);
-- Table: category_views
DROP TABLE IF EXISTS "category_views" CASCADE;
CREATE TABLE "category_views" (
"id" BIGSERIAL,
"ip_address" INET NOT NULL,
"user_agent" TEXT,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: comments
DROP TABLE IF EXISTS "comments" CASCADE;
CREATE TABLE "comments" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"body" TEXT NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"slug" VARCHAR(50) NOT NULL,
"parent_id" BIGINT,
"user_id" BIGINT NOT NULL,
"product_id" BIGINT NOT NULL
);
-- Table: django_admin_log
DROP TABLE IF EXISTS "django_admin_log" CASCADE;
CREATE TABLE "django_admin_log" (
"id" SERIAL,
"action_time" TIMESTAMP WITH TIME ZONE NOT NULL,
"object_id" TEXT,
"object_repr" VARCHAR(200) NOT NULL,
"action_flag" SMALLINT NOT NULL,
"change_message" TEXT NOT NULL,
"content_type_id" INTEGER,
"user_id" BIGINT NOT NULL
);
-- Data for table: django_admin_log
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (1, '2025-12-30T18:55:39.094335+00:00'::timestamptz, '1', 'Beyhan Oğur Kişisel Web Sitesi', 1, '[{"added": {}}]', 20, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (2, '2025-12-30T18:55:54.180958+00:00'::timestamptz, '1', 'Beyhan Oğur Kişisel Web Sitesi', 2, '[{"changed": {"fields": ["Twitter", "Yay\u0131ndam\u0131"]}}]', 20, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (3, '2025-12-30T19:09:45.598763+00:00'::timestamptz, '1', 'Beyhan Oğur Kişisel Web Sitesi', 2, '[]', 20, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (4, '2025-12-31T02:00:21.879635+00:00'::timestamptz, '1', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (5, '2025-12-31T02:00:21.879746+00:00'::timestamptz, '2', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (6, '2025-12-31T02:00:21.879803+00:00'::timestamptz, '3', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (7, '2025-12-31T02:00:21.879852+00:00'::timestamptz, '4', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (8, '2025-12-31T02:00:21.879896+00:00'::timestamptz, '5', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (9, '2025-12-31T02:00:21.879937+00:00'::timestamptz, '6', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (10, '2025-12-31T02:00:21.879977+00:00'::timestamptz, '7', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (11, '2025-12-31T02:00:21.880016+00:00'::timestamptz, '8', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (12, '2025-12-31T02:00:21.880055+00:00'::timestamptz, '9', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (13, '2025-12-31T02:00:21.880096+00:00'::timestamptz, '10', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (14, '2025-12-31T02:00:21.880135+00:00'::timestamptz, '11', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (15, '2025-12-31T02:03:31.317961+00:00'::timestamptz, '13', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (16, '2025-12-31T03:11:00.583368+00:00'::timestamptz, '12', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (17, '2025-12-31T03:11:00.585210+00:00'::timestamptz, '14', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (18, '2025-12-31T03:11:00.585261+00:00'::timestamptz, '15', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (19, '2025-12-31T03:11:00.585295+00:00'::timestamptz, '16', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (20, '2025-12-31T03:11:00.585326+00:00'::timestamptz, '17', 'Resimler: test', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (21, '2025-12-31T03:11:00.585355+00:00'::timestamptz, '18', 'Resimler: dfgdfgdfgdf', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (22, '2025-12-31T03:11:00.585383+00:00'::timestamptz, '19', 'Resimler: sfsf', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (23, '2025-12-31T03:11:00.585410+00:00'::timestamptz, '20', 'Resimler: sfsf', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (24, '2025-12-31T03:11:00.585437+00:00'::timestamptz, '21', 'Resimler: bg.png', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (25, '2025-12-31T03:11:00.585463+00:00'::timestamptz, '22', 'Resimler: man-8078578.jpg', 3, '', 22, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (26, '2025-12-31T03:57:02.170697+00:00'::timestamptz, '2', 'imagesUpload', 2, '[{"changed": {"fields": ["Type Veri", "Yay\u0131ndam\u0131"]}}]', 21, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (27, '2026-01-02T23:29:40.617717+00:00'::timestamptz, '1', 'Linux', 1, '[{"added": {}}]', 14, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (28, '2026-01-02T23:29:58.504694+00:00'::timestamptz, '1', 'linux', 1, '[{"added": {}}]', 13, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (29, '2026-01-02T23:30:15.827503+00:00'::timestamptz, '1', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 1, '[{"added": {}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (30, '2026-01-02T23:34:28.431444+00:00'::timestamptz, '1', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 2, '[{"changed": {"fields": ["Image"]}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (31, '2026-01-02T23:38:44.320607+00:00'::timestamptz, '1', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 2, '[{"changed": {"fields": ["Image"]}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (32, '2026-01-02T23:42:53.610393+00:00'::timestamptz, '1', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 2, '[{"changed": {"fields": ["Image"]}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (33, '2026-01-02T23:47:10.428246+00:00'::timestamptz, '1', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 2, '[{"changed": {"fields": ["Image"]}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (34, '2026-01-02T23:49:04.119509+00:00'::timestamptz, '2', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 1, '[{"added": {}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (35, '2026-01-02T23:51:46.297558+00:00'::timestamptz, '1', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 2, '[{"changed": {"fields": ["Image"]}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (36, '2026-01-02T23:55:25.046404+00:00'::timestamptz, '2', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 2, '[{"changed": {"fields": ["Image"]}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (37, '2026-01-02T23:55:53.466232+00:00'::timestamptz, '1', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 3, '', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (38, '2026-01-02T23:55:53.466315+00:00'::timestamptz, '2', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 3, '', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (39, '2026-01-02T23:56:31.046096+00:00'::timestamptz, '3', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 1, '[{"added": {}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (40, '2026-01-02T23:57:00.762261+00:00'::timestamptz, '3', 'Postlar: Beyhan Oğur Kişisel Web Sitesi', 3, '', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (41, '2026-01-02T23:58:01.818977+00:00'::timestamptz, '2', 'Linux -> Ubuntu', 1, '[{"added": {}}]', 14, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (42, '2026-01-02T23:58:13.249637+00:00'::timestamptz, '2', 'Ubuntu', 1, '[{"added": {}}]', 13, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (43, '2026-01-02T23:58:28.842114+00:00'::timestamptz, '4', 'Postlar: Ubuntu', 1, '[{"added": {}}]', 15, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (44, '2026-01-02T23:59:00.567345+00:00'::timestamptz, '3', 'Linux -> Debian', 1, '[{"added": {}}]', 14, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (45, '2026-01-02T23:59:10.997052+00:00'::timestamptz, '3', 'Debian', 1, '[{"added": {}}]', 13, 2);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (46, '2026-01-02T23:59:27.089944+00:00'::timestamptz, '5', 'Postlar: Debian', 1, '[{"added": {}}]', 15, 2);
-- Table: django_content_type
DROP TABLE IF EXISTS "django_content_type" CASCADE;
CREATE TABLE "django_content_type" (
"id" SERIAL,
"app_label" VARCHAR(100) NOT NULL,
"model" VARCHAR(100) NOT NULL
);
-- Data for table: django_content_type
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (1, 'admin', 'logentry');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (2, 'auth', 'permission');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (3, 'auth', 'group');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (4, 'contenttypes', 'contenttype');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (5, 'sessions', 'session');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (6, 'social_django', 'association');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (7, 'social_django', 'code');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (8, 'social_django', 'nonce');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (9, 'social_django', 'usersocialauth');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (10, 'social_django', 'partial');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (11, 'sites', 'site');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (12, 'accounts', 'customuser');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (13, 'blog', 'tags');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (14, 'blog', 'category');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (15, 'blog', 'post');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (16, 'blog', 'categoryview');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (17, 'blog', 'comment');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (18, 'backup', 'databasebackup');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (19, 'settings', 'banner');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (20, 'settings', 'setting');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (21, 'utils', 'jsontotype');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (22, 'image', 'postimages');
-- Table: django_migrations
DROP TABLE IF EXISTS "django_migrations" CASCADE;
CREATE TABLE "django_migrations" (
"id" BIGSERIAL,
"app" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"applied" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_migrations
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (1, 'contenttypes', '0001_initial', '2025-12-30T18:17:08.330092+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (2, 'contenttypes', '0002_remove_content_type_name', '2025-12-30T18:17:08.351286+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (3, 'auth', '0001_initial', '2025-12-30T18:17:08.445210+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (4, 'auth', '0002_alter_permission_name_max_length', '2025-12-30T18:17:08.458967+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (5, 'auth', '0003_alter_user_email_max_length', '2025-12-30T18:17:08.468563+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (6, 'auth', '0004_alter_user_username_opts', '2025-12-30T18:17:08.478860+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (7, 'auth', '0005_alter_user_last_login_null', '2025-12-30T18:17:08.491305+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (8, 'auth', '0006_require_contenttypes_0002', '2025-12-30T18:17:08.494948+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (9, 'auth', '0007_alter_validators_add_error_messages', '2025-12-30T18:17:08.504616+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (10, 'auth', '0008_alter_user_username_max_length', '2025-12-30T18:17:08.516260+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (11, 'auth', '0009_alter_user_last_name_max_length', '2025-12-30T18:17:08.526555+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (12, 'auth', '0010_alter_group_name_max_length', '2025-12-30T18:17:08.547665+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (13, 'auth', '0011_update_proxy_permissions', '2025-12-30T18:17:08.556969+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (14, 'auth', '0012_alter_user_first_name_max_length', '2025-12-30T18:17:08.566970+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (15, 'accounts', '0001_initial', '2025-12-30T18:17:08.652656+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (16, 'admin', '0001_initial', '2025-12-30T18:17:08.702073+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (17, 'admin', '0002_logentry_remove_auto_add', '2025-12-30T18:17:08.716545+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (18, 'admin', '0003_logentry_add_action_flag_choices', '2025-12-30T18:17:08.731230+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (19, 'backup', '0001_initial', '2025-12-30T18:17:08.781407+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (20, 'blog', '0001_initial', '2025-12-30T18:17:09.087345+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (21, 'sessions', '0001_initial', '2025-12-30T18:17:09.119329+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (22, 'settings', '0001_initial', '2025-12-30T18:17:09.157590+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (23, 'sites', '0001_initial', '2025-12-30T18:17:09.171572+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (24, 'sites', '0002_alter_domain_unique', '2025-12-30T18:17:09.183897+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (25, 'default', '0001_initial', '2025-12-30T18:17:09.384648+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (26, 'social_auth', '0001_initial', '2025-12-30T18:17:09.387073+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (27, 'default', '0002_add_related_name', '2025-12-30T18:17:09.417333+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (28, 'social_auth', '0002_add_related_name', '2025-12-30T18:17:09.419107+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (29, 'default', '0003_alter_email_max_length', '2025-12-30T18:17:09.434824+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (30, 'social_auth', '0003_alter_email_max_length', '2025-12-30T18:17:09.436128+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (31, 'default', '0004_auto_20160423_0400', '2025-12-30T18:17:09.459672+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (32, 'social_auth', '0004_auto_20160423_0400', '2025-12-30T18:17:09.461654+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (33, 'social_auth', '0005_auto_20160727_2333', '2025-12-30T18:17:09.470888+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (34, 'social_django', '0006_partial', '2025-12-30T18:17:09.497122+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (35, 'social_django', '0007_code_timestamp', '2025-12-30T18:17:09.516668+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (36, 'social_django', '0008_partial_timestamp', '2025-12-30T18:17:09.533165+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (37, 'social_django', '0009_auto_20191118_0520', '2025-12-30T18:17:09.585689+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (38, 'social_django', '0010_uid_db_index', '2025-12-30T18:17:09.618967+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (39, 'social_django', '0011_alter_id_fields', '2025-12-30T18:17:09.808993+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (40, 'social_django', '0012_usersocialauth_extra_data_new', '2025-12-30T18:17:09.857523+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (41, 'social_django', '0013_migrate_extra_data', '2025-12-30T18:17:09.918348+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (42, 'social_django', '0014_remove_usersocialauth_extra_data', '2025-12-30T18:17:09.945497+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (43, 'social_django', '0015_rename_extra_data_new_usersocialauth_extra_data', '2025-12-30T18:17:09.975453+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (44, 'social_django', '0016_alter_usersocialauth_extra_data', '2025-12-30T18:17:09.996294+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (45, 'social_django', '0017_usersocialauth_user_social_auth_uid_required', '2025-12-30T18:17:10.029865+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (46, 'utils', '0001_initial', '2025-12-30T18:17:10.084578+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (47, 'utils', '0002_alter_jsontotype_json_data', '2025-12-30T18:17:10.120797+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (48, 'utils', '0003_alter_jsontotype_type_data', '2025-12-30T18:17:10.156766+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (49, 'social_django', '0004_auto_20160423_0400', '2025-12-30T18:17:10.161715+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (50, 'social_django', '0003_alter_email_max_length', '2025-12-30T18:17:10.163125+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (51, 'social_django', '0002_add_related_name', '2025-12-30T18:17:10.164540+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (52, 'social_django', '0005_auto_20160727_2333', '2025-12-30T18:17:10.165856+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (53, 'social_django', '0001_initial', '2025-12-30T18:17:10.167315+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (54, 'image', '0001_initial', '2025-12-31T01:22:09.229707+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (55, 'image', '0002_rename_post_postimages', '2025-12-31T01:28:52.397886+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (56, 'blog', '0002_post_thumb', '2026-01-02T23:28:02.766992+00:00'::timestamptz);
-- Table: django_session
DROP TABLE IF EXISTS "django_session" CASCADE;
CREATE TABLE "django_session" (
"session_key" VARCHAR(40) NOT NULL,
"session_data" TEXT NOT NULL,
"expire_date" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_session
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('g4i88yck7vdoxe9eutjj3w9whhkmyw4g', '.eJxVjEEOwiAQRe_C2hBgEKhL9z0DGRhGqoYmpV0Z765NutDtf-_9l4i4rTVuvSxxInERRpx-t4T5UdoO6I7tNss8t3WZktwVedAux5nK83q4fwcVe_3Wvngmq4rLGrxGcJwGhZQNGD4ba7OxbEOAQA41kvUqZQAHgRm5uEG8P-SaOAU:1vaeqg:7qWgmCY7VwYRe7Mmjx_vtt6rIlV5oX4a7MA6hRz2dew', '2026-01-13T18:53:38.149980+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('g6dskgk17q7nijwap7dp7d03uj7ofa1x', '.eJxVjDEOgzAMAP_iuYpCnCaBsTtvQI4dF9oKJAJT1b9XSAztene6Nwy0b-Ow17IOk0AHDi6_LBM_y3wIedB8Xwwv87ZO2RyJOW01_SLldTvbv8FIdYQOYokq3pbADcaGMGhuLQk7dHp13rPz6lPCJIEaEh9tZsSASZW0hBY-X-SaOAU:1vagPN:pitIT9jBFoXSAqrMh8KpghHPhppr-LQZ684BymlO7sM', '2026-01-13T20:33:33.126150+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('k49n76nmufs4pn4iqtag08y90m2x892a', '.eJxVjEEOwiAQRe_C2hBgEKhL9z0DGRhGqoYmpV0Z765NutDtf-_9l4i4rTVuvSxxInERRpx-t4T5UdoO6I7tNss8t3WZktwVedAux5nK83q4fwcVe_3Wvngmq4rLGrxGcJwGhZQNGD4ba7OxbEOAQA41kvUqZQAHgRm5uEG8P-SaOAU:1valU7:jfm6FMwEuLBDGpRCWMs11GAJzjaunLBvFVG6RPsJdvU', '2026-01-14T01:58:47.775708+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('t0sfo6qw4ot8wta22jjjyebj8gwnngn4', '.eJxVjEEOwiAQRe_C2hBgEKhL9z0DGRhGqoYmpV0Z765NutDtf-_9l4i4rTVuvSxxInERRpx-t4T5UdoO6I7tNss8t3WZktwVedAux5nK83q4fwcVe_3Wvngmq4rLGrxGcJwGhZQNGD4ba7OxbEOAQA41kvUqZQAHgRm5uEG8P-SaOAU:1vbXOV:yzBl365vGyiDDlBIxcL3k3HJroN76hmgapE8smFpwnU', '2026-01-16T05:08:11.508142+00:00'::timestamptz);
-- Table: django_site
DROP TABLE IF EXISTS "django_site" CASCADE;
CREATE TABLE "django_site" (
"id" SERIAL,
"domain" VARCHAR(100) NOT NULL,
"name" VARCHAR(50) NOT NULL
);
-- Data for table: django_site
INSERT INTO "django_site" ("id", "domain", "name") VALUES (1, 'example.com', 'example.com');
-- Table: images
DROP TABLE IF EXISTS "images" CASCADE;
CREATE TABLE "images" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"path" VARCHAR(254) NOT NULL,
"processed_path" VARCHAR(254) NOT NULL,
"original_filename" VARCHAR(254) NOT NULL,
"format" VARCHAR(254) NOT NULL,
"width" INTEGER NOT NULL,
"height" INTEGER NOT NULL,
"size" INTEGER NOT NULL,
"quality" INTEGER NOT NULL,
"slug" VARCHAR(250) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"is_front" BOOLEAN NOT NULL
);
-- Data for table: images
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (23, 'man-8078578.jpg', 'processed/c45196ca-c4c8-483c-960f-7b1abf8348fd.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 2500, 2500, 842270, 85, 'man-8078578jpg', '2025-12-31T03:11:25.128251+00:00'::timestamptz, '2025-12-31T03:11:25.128333+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (24, 'man-8078578.jpg', 'processed/a909569d-2eb2-4695-b15a-892d1e15bfb3.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 1024, 768, 96194, 85, 'man-8078578jpg-2', '2025-12-31T03:14:33.379003+00:00'::timestamptz, '2025-12-31T03:14:33.379054+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (25, 'bg.png', 'processed/5525f98c-b5ca-401f-b94d-c600b6d54cc5.webp', 'bg.png', 'bg.png', 'webp', 1024, 768, 2056, 85, 'bgpng', '2025-12-31T03:27:35.979888+00:00'::timestamptz, '2025-12-31T03:27:35.979991+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (26, 'man-8078578.jpg', 'processed/2e569461-b384-44b6-82b4-cd038fc52696.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 1024, 768, 96194, 85, 'man-8078578jpg-3', '2025-12-31T03:39:24.337216+00:00'::timestamptz, '2025-12-31T03:39:24.337273+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (27, 'fdg', 'processed/cb0b5884-3350-41b2-8719-6568afdb6eaf.avif', 'man-8078578.jpg', 'man-8078578.jpg', 'avif', 1024, 768, 98594, 85, 'fdg', '2025-12-31T03:43:47.915365+00:00'::timestamptz, '2025-12-31T03:43:47.915583+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (28, 'bg.png', 'processed/19c28281-1e80-4ba7-a7a7-cd814260165b.webp', 'bg.png', 'bg.png', 'webp', 1024, 768, 2056, 85, 'bgpng-2', '2025-12-31T03:54:17.076433+00:00'::timestamptz, '2025-12-31T03:54:17.076492+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (29, 'man-8078578.jpg', 'processed/3ae4d4c9-4fe9-4ceb-ad71-a24e9d328f8e.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 1000, 2500, 340654, 85, 'man-8078578jpg-4', '2025-12-31T03:54:51.810029+00:00'::timestamptz, '2025-12-31T03:54:51.810048+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (30, 'man-8078578.jpg', 'processed/3f154559-45df-4b76-acdb-7de9c30c55cc.avif', 'man-8078578.jpg', 'man-8078578.jpg', 'avif', 1500, 2500, 671539, 85, 'man-8078578jpg-5', '2025-12-31T03:55:16.103659+00:00'::timestamptz, '2025-12-31T03:55:16.103677+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (31, 'man-8078578.jpg', 'processed/6def36bd-da5b-40be-b3a6-c07c7b9897cc.avif', 'man-8078578.jpg', 'man-8078578.jpg', 'avif', 1750, 2500, 800443, 85, 'man-8078578jpg-6', '2025-12-31T03:55:33.141032+00:00'::timestamptz, '2025-12-31T03:55:33.141056+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (32, 'man-8078578.jpg', 'processed/8d341f66-2283-4372-bb0e-ce77cad29c98.avif', 'man-8078578.jpg', 'man-8078578.jpg', 'avif', 2000, 2500, 793785, 85, 'man-8078578jpg-7', '2025-12-31T03:55:48.214844+00:00'::timestamptz, '2025-12-31T03:55:48.214863+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (33, 'man-8078578.jpg', 'processed/308c3fa8-81fc-4f6d-9977-7d9c7dce5b4f.png', 'man-8078578.jpg', 'man-8078578.jpg', 'png', 2000, 2500, 4380851, 85, 'man-8078578jpg-8', '2025-12-31T03:56:03.307634+00:00'::timestamptz, '2025-12-31T03:56:03.307657+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (34, 'man-8078578.jpg', 'processed/c29b9093-5427-460a-8799-770a4f65a7e4.avif', 'man-8078578.jpg', 'man-8078578.jpg', 'avif', 2000, 2500, 793785, 100, 'man-8078578jpg-9', '2025-12-31T04:35:45.558471+00:00'::timestamptz, '2025-12-31T04:35:45.558554+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (35, 'man-8078578.jpg', 'processed/5768116b-f8e6-46c1-a59a-be73ec7cda39.avif', 'man-8078578.jpg', 'man-8078578.jpg', 'avif', 2000, 2500, 918693, 100, 'man-8078578jpg-10', '2025-12-31T04:41:37.967876+00:00'::timestamptz, '2025-12-31T04:41:37.967907+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (36, 'man-8078578.jpg', 'processed/672e27e1-8f0e-4295-8f85-e67cb6bd389a.avif', 'man-8078578.jpg', 'man-8078578.jpg', 'avif', 2000, 2000, 698099, 100, 'man-8078578jpg-11', '2025-12-31T04:41:55.643779+00:00'::timestamptz, '2025-12-31T04:41:55.643812+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (37, 'dsfsf', 'processed/782cd500-0981-4587-b34a-16de07bfdaf9.webp', 'team-4451672.jpg', 'team-4451672.jpg', 'webp', 1024, 768, 126140, 85, 'dsfsf', '2025-12-31T04:46:54.262233+00:00'::timestamptz, '2025-12-31T04:46:54.262260+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (38, 'dsfsf', 'processed/8b0cf958-e486-487c-8761-4072cf478f27.webp', 'team-4451672.jpg', 'team-4451672.jpg', 'webp', 1024, 768, 126140, 85, 'dsfsf-1', '2025-12-31T04:47:11.907274+00:00'::timestamptz, '2025-12-31T04:47:11.907477+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (39, 'man-8078578.jpg', 'processed/a60f8a14-1236-4e4b-a333-6b05212c8f11.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 1024, 768, 174262, 85, 'man-8078578jpg-12', '2025-12-31T04:47:43.466100+00:00'::timestamptz, '2025-12-31T04:47:43.466215+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (40, 'man-8078578.jpg', 'processed/9b7d9dc4-54b1-44d9-8330-c70d06166e0c.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 1024, 768, 174262, 85, 'man-8078578jpg-13', '2025-12-31T04:51:50.539713+00:00'::timestamptz, '2025-12-31T04:51:50.539796+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (41, 'team-4451672.jpg', 'processed/1368495e-8791-4771-a775-20f738df23da.webp', 'team-4451672.jpg', 'team-4451672.jpg', 'webp', 1024, 768, 126140, 85, 'team-4451672jpg', '2025-12-31T04:57:50.642611+00:00'::timestamptz, '2025-12-31T04:57:50.642723+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (42, 'fsdfs', 'processed/1bb738e2-bdb9-4ca0-829d-ed7f517740f5.webp', 'bg.png', 'bg.png', 'webp', 1024, 768, 5094, 85, 'fsdfs', '2025-12-31T05:01:31.600829+00:00'::timestamptz, '2025-12-31T05:01:31.600943+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (43, 'man-8078578.jpg', 'processed/4b841cf0-2f24-42b0-a8a2-fc87b81fd476.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 1024, 768, 174262, 85, 'man-8078578jpg-14', '2025-12-31T05:04:23.886081+00:00'::timestamptz, '2025-12-31T05:04:23.886195+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (44, 'man-8078578.jpg', 'processed/228ed09a-3064-4f0b-b286-61f5ae4ff03a.png', 'man-8078578.jpg', 'man-8078578.jpg', 'png', 1024, 768, 922822, 85, 'man-8078578jpg-15', '2025-12-31T05:05:11.322090+00:00'::timestamptz, '2025-12-31T05:05:11.322119+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (45, 'man-8078578.jpg', 'processed/1fbcab6f-f70f-40c7-a198-184c9f93b563.avif', 'man-8078578.jpg', 'man-8078578.jpg', 'avif', 1024, 768, 170509, 85, 'man-8078578jpg-16', '2025-12-31T05:05:17.797040+00:00'::timestamptz, '2025-12-31T05:05:17.797068+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (46, 'man-8078578.jpg', 'processed/c043015d-40ce-4050-9062-4ee827fbd3bc.png', 'man-8078578.jpg', 'man-8078578.jpg', 'png', 1024, 768, 922822, 85, 'man-8078578jpg-17', '2025-12-31T05:05:22.783451+00:00'::timestamptz, '2025-12-31T05:05:22.783471+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (47, 'man-8078578.jpg', 'processed/c33bec56-00e4-4cd3-bd94-771c3635fbcb.png', 'man-8078578.jpg', 'man-8078578.jpg', 'png', 1024, 768, 922822, 85, 'man-8078578jpg-18', '2025-12-31T05:05:25.607543+00:00'::timestamptz, '2025-12-31T05:05:25.607578+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (48, 'man-8078578.jpg', 'processed/8939ca86-5150-4e13-905e-c2d332ed79f6.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 1024, 768, 174262, 85, 'man-8078578jpg-19', '2025-12-31T05:05:34.833822+00:00'::timestamptz, '2025-12-31T05:05:34.833841+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (49, 'man-8078578.jpg', 'processed/f0fef162-8a54-4158-800e-6b5d24c4163f.jpg', 'man-8078578.jpg', 'man-8078578.jpg', 'jpg', 1024, 768, 203261, 85, 'man-8078578jpg-20', '2025-12-31T05:08:21.105323+00:00'::timestamptz, '2025-12-31T05:08:21.105350+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (50, 'man-8078578.jpg', 'processed/2dbd1030-7450-4680-a11a-e34c71e1e69a.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 1024, 768, 174262, 85, 'man-8078578jpg-21', '2025-12-31T05:08:29.716880+00:00'::timestamptz, '2025-12-31T05:08:29.716902+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (51, 'man-8078578.jpg', 'processed/cf71c4c7-6b55-4a81-bee9-766969993940.png', 'man-8078578.jpg', 'man-8078578.jpg', 'png', 1024, 768, 922822, 85, 'man-8078578jpg-22', '2025-12-31T05:08:34.729310+00:00'::timestamptz, '2025-12-31T05:08:34.729415+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (52, 'man-8078578.jpg', 'processed/73f46f57-a671-43ca-b55f-45029dbe8683.avif', 'man-8078578.jpg', 'man-8078578.jpg', 'avif', 1024, 768, 170509, 85, 'man-8078578jpg-23', '2025-12-31T05:08:39.768289+00:00'::timestamptz, '2025-12-31T05:08:39.768325+00:00'::timestamptz, true, true);
INSERT INTO "images" ("id", "title", "path", "processed_path", "original_filename", "format", "width", "height", "size", "quality", "slug", "created_at", "updated_at", "is_active", "is_front") VALUES (53, 'man-8078578.jpg', 'processed/6bf75ab5-914f-4c8d-bfcc-1c10d8dea34a.webp', 'man-8078578.jpg', 'man-8078578.jpg', 'webp', 1024, 768, 174262, 85, 'man-8078578jpg-24', '2025-12-31T17:32:59.698645+00:00'::timestamptz, '2025-12-31T17:32:59.698747+00:00'::timestamptz, true, true);
-- Table: json_to_type
DROP TABLE IF EXISTS "json_to_type" CASCADE;
CREATE TABLE "json_to_type" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"json_data" JSONB NOT NULL,
"type_data" TEXT NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"user_id" BIGINT NOT NULL
);
-- Data for table: json_to_type
INSERT INTO "json_to_type" ("id", "title", "json_data", "type_data", "created_at", "updated_at", "is_active", "user_id") VALUES (1, 'Setting', '{
"user":""
}', 'export interface Setting {
user: string;
}', '2025-12-31T03:01:38.458401+00:00'::timestamptz, '2025-12-31T03:01:38.458425+00:00'::timestamptz, false, 2);
INSERT INTO "json_to_type" ("id", "title", "json_data", "type_data", "created_at", "updated_at", "is_active", "user_id") VALUES (2, 'imagesUpload', '{
"id": 18,
"title": "dfgdfgdfgdf",
"path": "processed/e503d0c9-8509-4022-a335-4521655e6a7a.webp",
"processed_path": "man-8078578.jpg",
"original_filename": "man-8078578.jpg",
"format": "webp",
"width": 100,
"height": 120,
"size": 3236,
"quality": 85,
"slug": "dfgdfgdfgdf",
"created_at": "2025-12-31T02:56:21.231264Z",
"updated_at": "2025-12-31T02:56:21.231296Z",
"is_active": true,
"is_front": true
}', 'export interface imagesUpload {
id: number;
title: string;
path: string;
processed_path: string;
original_filename: string;
format: string;
width: number;
height: number;
size: number;
quality: number;
slug: string;
created_at: string;
updated_at: string;
is_active: boolean;
is_front: boolean;
}', '2025-12-31T03:29:42.536487+00:00'::timestamptz, '2025-12-31T03:57:02.145557+00:00'::timestamptz, true, 2);
INSERT INTO "json_to_type" ("id", "title", "json_data", "type_data", "created_at", "updated_at", "is_active", "user_id") VALUES (3, 'dsfsdf', '{}', 'export interface MyTypeasdad {
}', '2025-12-31T15:19:12.784030+00:00'::timestamptz, '2025-12-31T15:19:12.784047+00:00'::timestamptz, false, 2);
-- Table: posts
DROP TABLE IF EXISTS "posts" CASCADE;
CREATE TABLE "posts" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"content" TEXT,
"keywords" VARCHAR(254) NOT NULL,
"image" VARCHAR(100),
"video" VARCHAR(254),
"slug" VARCHAR(250) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"is_front" BOOLEAN NOT NULL,
"parent_id" BIGINT,
"thumb" VARCHAR(100)
);
-- Data for table: posts
INSERT INTO "posts" ("id", "title", "content", "keywords", "image", "video", "slug", "created_at", "updated_at", "is_active", "is_front", "parent_id", "thumb") VALUES (4, 'Ubuntu', 'Ubuntu', 'Ubuntu', 'uploads/post/347670c277b94891b5b38697452ab835.avif', 'none', 'ubuntu', '2026-01-02T23:58:28.717897+00:00'::timestamptz, '2026-01-02T23:58:28.717914+00:00'::timestamptz, true, true, NULL, 'uploads/post/thumb/39a1710e813749e78dcd5c09185f53b9.avif');
INSERT INTO "posts" ("id", "title", "content", "keywords", "image", "video", "slug", "created_at", "updated_at", "is_active", "is_front", "parent_id", "thumb") VALUES (5, 'Debian', 'Debian', 'Debian', 'uploads/post/adf3e434a17f44b38ae1711128b637d4.avif', 'none', 'debian', '2026-01-02T23:59:26.968381+00:00'::timestamptz, '2026-01-02T23:59:26.968406+00:00'::timestamptz, true, true, NULL, 'uploads/post/thumb/b14552c5c7a64d119924c1399812e797.avif');
-- Table: posts_categories
DROP TABLE IF EXISTS "posts_categories" CASCADE;
CREATE TABLE "posts_categories" (
"id" BIGSERIAL,
"post_id" BIGINT NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Data for table: posts_categories
INSERT INTO "posts_categories" ("id", "post_id", "category_id") VALUES (4, 4, 2);
INSERT INTO "posts_categories" ("id", "post_id", "category_id") VALUES (5, 5, 3);
-- Table: posts_tags
DROP TABLE IF EXISTS "posts_tags" CASCADE;
CREATE TABLE "posts_tags" (
"id" BIGSERIAL,
"post_id" BIGINT NOT NULL,
"tags_id" BIGINT NOT NULL
);
-- Data for table: posts_tags
INSERT INTO "posts_tags" ("id", "post_id", "tags_id") VALUES (4, 4, 2);
INSERT INTO "posts_tags" ("id", "post_id", "tags_id") VALUES (5, 5, 1);
INSERT INTO "posts_tags" ("id", "post_id", "tags_id") VALUES (6, 5, 3);
-- Table: settings
DROP TABLE IF EXISTS "settings" CASCADE;
CREATE TABLE "settings" (
"id" BIGSERIAL,
"title" VARCHAR(254) NOT NULL,
"meta_title" VARCHAR(254) NOT NULL,
"meta_description" VARCHAR(254) NOT NULL,
"phone" VARCHAR(254) NOT NULL,
"url" VARCHAR(254),
"email" VARCHAR(254) NOT NULL,
"facebook" VARCHAR(254),
"x" VARCHAR(254),
"instagram" VARCHAR(254),
"whatsapp" VARCHAR(254),
"slogan" VARCHAR(254),
"w_logo" VARCHAR(100),
"b_logo" VARCHAR(100),
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Data for table: settings
INSERT INTO "settings" ("id", "title", "meta_title", "meta_description", "phone", "url", "email", "facebook", "x", "instagram", "whatsapp", "slogan", "w_logo", "b_logo", "created_at", "updated_at", "is_active") VALUES (1, 'Beyhan Oğur Kişisel Web Sitesi', 'Meta Title', 'Meta Description', '+90 (500) 222 44 64', 'https://beyhanogur.com.tr', 'admin@demo.com', 'https://www.facebook.com', 'https://www.x.com', 'https://www.instagram.com', 'https://www.whatsapp.com', 'Beyhan Site Başlık Solaganı', 'uploads/logo/bg.png', 'uploads/logo/bg_jsYKjv5.png', '2025-12-30T18:55:38.870973+00:00'::timestamptz, '2025-12-30T19:09:45.593096+00:00'::timestamptz, true);
-- Table: social_auth_association
DROP TABLE IF EXISTS "social_auth_association" CASCADE;
CREATE TABLE "social_auth_association" (
"id" BIGSERIAL,
"server_url" VARCHAR(255) NOT NULL,
"handle" VARCHAR(255) NOT NULL,
"secret" VARCHAR(255) NOT NULL,
"issued" INTEGER NOT NULL,
"lifetime" INTEGER NOT NULL,
"assoc_type" VARCHAR(64) NOT NULL
);
-- Table: social_auth_code
DROP TABLE IF EXISTS "social_auth_code" CASCADE;
CREATE TABLE "social_auth_code" (
"id" BIGSERIAL,
"email" VARCHAR(254) NOT NULL,
"code" VARCHAR(32) NOT NULL,
"verified" BOOLEAN NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: social_auth_nonce
DROP TABLE IF EXISTS "social_auth_nonce" CASCADE;
CREATE TABLE "social_auth_nonce" (
"id" BIGSERIAL,
"server_url" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL,
"salt" VARCHAR(65) NOT NULL
);
-- Table: social_auth_partial
DROP TABLE IF EXISTS "social_auth_partial" CASCADE;
CREATE TABLE "social_auth_partial" (
"id" BIGSERIAL,
"token" VARCHAR(32) NOT NULL,
"next_step" SMALLINT NOT NULL,
"backend" VARCHAR(32) NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL,
"data" JSONB NOT NULL
);
-- Table: social_auth_usersocialauth
DROP TABLE IF EXISTS "social_auth_usersocialauth" CASCADE;
CREATE TABLE "social_auth_usersocialauth" (
"id" BIGSERIAL,
"provider" VARCHAR(32) NOT NULL,
"uid" VARCHAR(255) NOT NULL,
"user_id" BIGINT NOT NULL,
"created" TIMESTAMP WITH TIME ZONE NOT NULL,
"modified" TIMESTAMP WITH TIME ZONE NOT NULL,
"extra_data" JSONB NOT NULL
);
-- Table: tags
DROP TABLE IF EXISTS "tags" CASCADE;
CREATE TABLE "tags" (
"id" BIGSERIAL,
"tag" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Data for table: tags
INSERT INTO "tags" ("id", "tag", "created_at", "updated_at", "is_active") VALUES (1, 'linux', '2026-01-02T23:29:58.464268+00:00'::timestamptz, '2026-01-02T23:29:58.464283+00:00'::timestamptz, true);
INSERT INTO "tags" ("id", "tag", "created_at", "updated_at", "is_active") VALUES (2, 'Ubuntu', '2026-01-02T23:58:13.208638+00:00'::timestamptz, '2026-01-02T23:58:13.208655+00:00'::timestamptz, true);
INSERT INTO "tags" ("id", "tag", "created_at", "updated_at", "is_active") VALUES (3, 'Debian', '2026-01-02T23:59:10.955258+00:00'::timestamptz, '2026-01-02T23:59:10.955285+00:00'::timestamptz, true);
-- Reset sequences
SELECT setval('django_migrations_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_migrations"));
SELECT setval('django_content_type_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_content_type"));
SELECT setval('auth_permission_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_permission"));
SELECT setval('auth_group_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group"));
SELECT setval('auth_group_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group_permissions"));
SELECT setval('accounts_customuser_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser"));
SELECT setval('accounts_customuser_groups_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_groups"));
SELECT setval('accounts_customuser_user_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_user_permissions"));
SELECT setval('django_admin_log_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_admin_log"));
SELECT setval('backup_databasebackup_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "backup_databasebackup"));
SELECT setval('tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "tags"));
SELECT setval('categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "categories"));
SELECT setval('posts_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts"));
SELECT setval('posts_categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_categories"));
SELECT setval('posts_tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_tags"));
SELECT setval('category_views_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "category_views"));
SELECT setval('comments_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "comments"));
SELECT setval('banners_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "banners"));
SELECT setval('settings_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "settings"));
SELECT setval('django_site_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_site"));
SELECT setval('social_auth_association_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_association"));
SELECT setval('social_auth_code_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_code"));
SELECT setval('social_auth_nonce_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_nonce"));
SELECT setval('social_auth_usersocialauth_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_usersocialauth"));
SELECT setval('social_auth_partial_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_partial"));
SELECT setval('json_to_type_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "json_to_type"));
SELECT setval('images_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "images"));

View File

@@ -0,0 +1,526 @@
-- PostgreSQL Database Backup
-- Database: server_dj_test
-- Date: 2025-12-24 17:53:53.003629
-- Created by Django Backup System using psycopg2
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
-- Table: accounts_customuser
DROP TABLE IF EXISTS "accounts_customuser" CASCADE;
CREATE TABLE "accounts_customuser" (
"id" BIGINT NOT NULL,
"password" VARCHAR(128) NOT NULL,
"last_login" TIMESTAMP WITH TIME ZONE,
"is_superuser" BOOLEAN NOT NULL,
"email" VARCHAR(254) NOT NULL,
"first_name" VARCHAR(150) NOT NULL,
"last_name" VARCHAR(150) NOT NULL,
"is_staff" BOOLEAN NOT NULL,
"is_active" BOOLEAN NOT NULL,
"date_joined" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: accounts_customuser
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (1, 'pbkdf2_sha256$1000000$u1P0iFbGOM2z5Cwk30yJNO$TPhvLzXuCeSWXc4cCpQIDYv8ZZGs0S1RbWuN2aefwCQ=', '2025-12-24T17:53:25.150388+00:00'::timestamptz, true, 'beyhan@beyhan.dev', '', '', true, true, '2025-12-24T17:53:11.303375+00:00'::timestamptz);
-- Table: accounts_customuser_groups
DROP TABLE IF EXISTS "accounts_customuser_groups" CASCADE;
CREATE TABLE "accounts_customuser_groups" (
"id" BIGINT NOT NULL,
"customuser_id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL
);
-- Table: accounts_customuser_user_permissions
DROP TABLE IF EXISTS "accounts_customuser_user_permissions" CASCADE;
CREATE TABLE "accounts_customuser_user_permissions" (
"id" BIGINT NOT NULL,
"customuser_id" BIGINT NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_group
DROP TABLE IF EXISTS "auth_group" CASCADE;
CREATE TABLE "auth_group" (
"id" INTEGER NOT NULL,
"name" VARCHAR(150) NOT NULL
);
-- Table: auth_group_permissions
DROP TABLE IF EXISTS "auth_group_permissions" CASCADE;
CREATE TABLE "auth_group_permissions" (
"id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_permission
DROP TABLE IF EXISTS "auth_permission" CASCADE;
CREATE TABLE "auth_permission" (
"id" INTEGER NOT NULL,
"name" VARCHAR(255) NOT NULL,
"content_type_id" INTEGER NOT NULL,
"codename" VARCHAR(100) NOT NULL
);
-- Data for table: auth_permission
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (1, 'Can add log entry', 1, 'add_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (2, 'Can change log entry', 1, 'change_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (3, 'Can delete log entry', 1, 'delete_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (4, 'Can view log entry', 1, 'view_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (5, 'Can add permission', 2, 'add_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (6, 'Can change permission', 2, 'change_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (7, 'Can delete permission', 2, 'delete_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (8, 'Can view permission', 2, 'view_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (9, 'Can add group', 3, 'add_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (10, 'Can change group', 3, 'change_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (11, 'Can delete group', 3, 'delete_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (12, 'Can view group', 3, 'view_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (13, 'Can add content type', 4, 'add_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (14, 'Can change content type', 4, 'change_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (15, 'Can delete content type', 4, 'delete_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (16, 'Can view content type', 4, 'view_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (17, 'Can add session', 5, 'add_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (18, 'Can change session', 5, 'change_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (19, 'Can delete session', 5, 'delete_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (20, 'Can view session', 5, 'view_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (21, 'Can add association', 6, 'add_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (22, 'Can change association', 6, 'change_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (23, 'Can delete association', 6, 'delete_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (24, 'Can view association', 6, 'view_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (25, 'Can add code', 7, 'add_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (26, 'Can change code', 7, 'change_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (27, 'Can delete code', 7, 'delete_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (28, 'Can view code', 7, 'view_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (29, 'Can add nonce', 8, 'add_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (30, 'Can change nonce', 8, 'change_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (31, 'Can delete nonce', 8, 'delete_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (32, 'Can view nonce', 8, 'view_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (33, 'Can add user social auth', 9, 'add_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (34, 'Can change user social auth', 9, 'change_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (35, 'Can delete user social auth', 9, 'delete_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (36, 'Can view user social auth', 9, 'view_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (37, 'Can add partial', 10, 'add_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (38, 'Can change partial', 10, 'change_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (39, 'Can delete partial', 10, 'delete_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (40, 'Can view partial', 10, 'view_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (41, 'Can add site', 11, 'add_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (42, 'Can change site', 11, 'change_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (43, 'Can delete site', 11, 'delete_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (44, 'Can view site', 11, 'view_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (45, 'Can add user', 12, 'add_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (46, 'Can change user', 12, 'change_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (47, 'Can delete user', 12, 'delete_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (48, 'Can view user', 12, 'view_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (49, 'Can add Post Tagı', 13, 'add_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (50, 'Can change Post Tagı', 13, 'change_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (51, 'Can delete Post Tagı', 13, 'delete_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (52, 'Can view Post Tagı', 13, 'view_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (53, 'Can add Post Kategori', 14, 'add_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (54, 'Can change Post Kategori', 14, 'change_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (55, 'Can delete Post Kategori', 14, 'delete_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (56, 'Can view Post Kategori', 14, 'view_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (57, 'Can add Post', 15, 'add_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (58, 'Can change Post', 15, 'change_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (59, 'Can delete Post', 15, 'delete_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (60, 'Can view Post', 15, 'view_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (61, 'Can add Kategori Ziyareti', 16, 'add_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (62, 'Can change Kategori Ziyareti', 16, 'change_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (63, 'Can delete Kategori Ziyareti', 16, 'delete_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (64, 'Can view Kategori Ziyareti', 16, 'view_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (65, 'Can add Post Yorum', 17, 'add_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (66, 'Can change Post Yorum', 17, 'change_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (67, 'Can delete Post Yorum', 17, 'delete_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (68, 'Can view Post Yorum', 17, 'view_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (69, 'Can add Veritabanı Yedeği', 18, 'add_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (70, 'Can change Veritabanı Yedeği', 18, 'change_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (71, 'Can delete Veritabanı Yedeği', 18, 'delete_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (72, 'Can view Veritabanı Yedeği', 18, 'view_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (73, 'Can add Banner', 19, 'add_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (74, 'Can change Banner', 19, 'change_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (75, 'Can delete Banner', 19, 'delete_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (76, 'Can view Banner', 19, 'view_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (77, 'Can add Site Ayarı', 20, 'add_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (78, 'Can change Site Ayarı', 20, 'change_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (79, 'Can delete Site Ayarı', 20, 'delete_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (80, 'Can view Site Ayarı', 20, 'view_setting');
-- Table: backup_databasebackup
DROP TABLE IF EXISTS "backup_databasebackup" CASCADE;
CREATE TABLE "backup_databasebackup" (
"id" BIGINT NOT NULL,
"name" VARCHAR(255) NOT NULL,
"file_path" VARCHAR(500),
"file_size" BIGINT,
"status" VARCHAR(20) NOT NULL,
"backup_type" VARCHAR(20) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"completed_at" TIMESTAMP WITH TIME ZONE,
"error_message" TEXT,
"notes" TEXT,
"created_by_id" BIGINT
);
-- Data for table: backup_databasebackup
INSERT INTO "backup_databasebackup" ("id", "name", "file_path", "file_size", "status", "backup_type", "created_at", "completed_at", "error_message", "notes", "created_by_id") VALUES (1, 'Manuel Yedek - 2025-12-24 17:53:52', NULL, NULL, 'in_progress', 'manual', '2025-12-24T17:53:52.965869+00:00'::timestamptz, NULL, NULL, NULL, 1);
-- Table: banners
DROP TABLE IF EXISTS "banners" CASCADE;
CREATE TABLE "banners" (
"id" BIGINT NOT NULL,
"color" VARCHAR(25) NOT NULL,
"title" VARCHAR(254),
"text1" VARCHAR(254),
"text2" VARCHAR(254),
"text4" VARCHAR(254),
"text5" VARCHAR(254),
"image" VARCHAR(100) NOT NULL,
"image_k" VARCHAR(100),
"image_k_txt" VARCHAR(254),
"is_active" BOOLEAN NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: categories
DROP TABLE IF EXISTS "categories" CASCADE;
CREATE TABLE "categories" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"keywords" VARCHAR(254) NOT NULL,
"description" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"order" INTEGER NOT NULL,
"slug" VARCHAR(250) NOT NULL,
"image" VARCHAR(100),
"parent_id" BIGINT
);
-- Table: category_views
DROP TABLE IF EXISTS "category_views" CASCADE;
CREATE TABLE "category_views" (
"id" BIGINT NOT NULL,
"ip_address" INET NOT NULL,
"user_agent" TEXT,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: comments
DROP TABLE IF EXISTS "comments" CASCADE;
CREATE TABLE "comments" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"body" TEXT NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"slug" VARCHAR(50) NOT NULL,
"parent_id" BIGINT,
"user_id" BIGINT NOT NULL,
"product_id" BIGINT NOT NULL
);
-- Table: django_admin_log
DROP TABLE IF EXISTS "django_admin_log" CASCADE;
CREATE TABLE "django_admin_log" (
"id" INTEGER NOT NULL,
"action_time" TIMESTAMP WITH TIME ZONE NOT NULL,
"object_id" TEXT,
"object_repr" VARCHAR(200) NOT NULL,
"action_flag" SMALLINT NOT NULL,
"change_message" TEXT NOT NULL,
"content_type_id" INTEGER,
"user_id" BIGINT NOT NULL
);
-- Table: django_content_type
DROP TABLE IF EXISTS "django_content_type" CASCADE;
CREATE TABLE "django_content_type" (
"id" INTEGER NOT NULL,
"app_label" VARCHAR(100) NOT NULL,
"model" VARCHAR(100) NOT NULL
);
-- Data for table: django_content_type
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (1, 'admin', 'logentry');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (2, 'auth', 'permission');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (3, 'auth', 'group');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (4, 'contenttypes', 'contenttype');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (5, 'sessions', 'session');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (6, 'social_django', 'association');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (7, 'social_django', 'code');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (8, 'social_django', 'nonce');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (9, 'social_django', 'usersocialauth');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (10, 'social_django', 'partial');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (11, 'sites', 'site');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (12, 'accounts', 'customuser');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (13, 'blog', 'tags');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (14, 'blog', 'category');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (15, 'blog', 'post');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (16, 'blog', 'categoryview');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (17, 'blog', 'comment');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (18, 'backup', 'databasebackup');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (19, 'settings', 'banner');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (20, 'settings', 'setting');
-- Table: django_migrations
DROP TABLE IF EXISTS "django_migrations" CASCADE;
CREATE TABLE "django_migrations" (
"id" BIGINT NOT NULL,
"app" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"applied" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_migrations
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (1, 'contenttypes', '0001_initial', '2025-12-24T17:52:43.845116+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (2, 'contenttypes', '0002_remove_content_type_name', '2025-12-24T17:52:43.863713+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (3, 'auth', '0001_initial', '2025-12-24T17:52:43.935604+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (4, 'auth', '0002_alter_permission_name_max_length', '2025-12-24T17:52:43.951365+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (5, 'auth', '0003_alter_user_email_max_length', '2025-12-24T17:52:43.964620+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (6, 'auth', '0004_alter_user_username_opts', '2025-12-24T17:52:43.977833+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (7, 'auth', '0005_alter_user_last_login_null', '2025-12-24T17:52:43.990016+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (8, 'auth', '0006_require_contenttypes_0002', '2025-12-24T17:52:43.998463+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (9, 'auth', '0007_alter_validators_add_error_messages', '2025-12-24T17:52:44.012382+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (10, 'auth', '0008_alter_user_username_max_length', '2025-12-24T17:52:44.026522+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (11, 'auth', '0009_alter_user_last_name_max_length', '2025-12-24T17:52:44.039605+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (12, 'auth', '0010_alter_group_name_max_length', '2025-12-24T17:52:44.069435+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (13, 'auth', '0011_update_proxy_permissions', '2025-12-24T17:52:44.081493+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (14, 'auth', '0012_alter_user_first_name_max_length', '2025-12-24T17:52:44.095286+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (15, 'accounts', '0001_initial', '2025-12-24T17:52:44.239074+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (16, 'admin', '0001_initial', '2025-12-24T17:52:44.304825+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (17, 'admin', '0002_logentry_remove_auto_add', '2025-12-24T17:52:44.318239+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (18, 'admin', '0003_logentry_add_action_flag_choices', '2025-12-24T17:52:44.335477+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (19, 'backup', '0001_initial', '2025-12-24T17:52:44.475575+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (20, 'blog', '0001_initial', '2025-12-24T17:52:44.799361+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (21, 'sessions', '0001_initial', '2025-12-24T17:52:44.831822+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (22, 'settings', '0001_initial', '2025-12-24T17:52:44.879705+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (23, 'sites', '0001_initial', '2025-12-24T17:52:44.903306+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (24, 'sites', '0002_alter_domain_unique', '2025-12-24T17:52:44.924515+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (25, 'default', '0001_initial', '2025-12-24T17:52:45.067098+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (26, 'social_auth', '0001_initial', '2025-12-24T17:52:45.072695+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (27, 'default', '0002_add_related_name', '2025-12-24T17:52:45.095480+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (28, 'social_auth', '0002_add_related_name', '2025-12-24T17:52:45.099517+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (29, 'default', '0003_alter_email_max_length', '2025-12-24T17:52:45.122647+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (30, 'social_auth', '0003_alter_email_max_length', '2025-12-24T17:52:45.125593+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (31, 'default', '0004_auto_20160423_0400', '2025-12-24T17:52:45.142991+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (32, 'social_auth', '0004_auto_20160423_0400', '2025-12-24T17:52:45.146933+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (33, 'social_auth', '0005_auto_20160727_2333', '2025-12-24T17:52:45.163032+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (34, 'social_django', '0006_partial', '2025-12-24T17:52:45.206595+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (35, 'social_django', '0007_code_timestamp', '2025-12-24T17:52:45.236352+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (36, 'social_django', '0008_partial_timestamp', '2025-12-24T17:52:45.263722+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (37, 'social_django', '0009_auto_20191118_0520', '2025-12-24T17:52:45.312704+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (38, 'social_django', '0010_uid_db_index', '2025-12-24T17:52:45.341894+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (39, 'social_django', '0011_alter_id_fields', '2025-12-24T17:52:45.443986+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (40, 'social_django', '0012_usersocialauth_extra_data_new', '2025-12-24T17:52:45.482091+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (41, 'social_django', '0013_migrate_extra_data', '2025-12-24T17:52:45.555931+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (42, 'social_django', '0014_remove_usersocialauth_extra_data', '2025-12-24T17:52:45.587466+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (43, 'social_django', '0015_rename_extra_data_new_usersocialauth_extra_data', '2025-12-24T17:52:45.615244+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (44, 'social_django', '0016_alter_usersocialauth_extra_data', '2025-12-24T17:52:45.632400+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (45, 'social_django', '0017_usersocialauth_user_social_auth_uid_required', '2025-12-24T17:52:45.659854+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (46, 'social_django', '0002_add_related_name', '2025-12-24T17:52:45.669891+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (47, 'social_django', '0003_alter_email_max_length', '2025-12-24T17:52:45.675697+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (48, 'social_django', '0004_auto_20160423_0400', '2025-12-24T17:52:45.680972+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (49, 'social_django', '0001_initial', '2025-12-24T17:52:45.686400+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (50, 'social_django', '0005_auto_20160727_2333', '2025-12-24T17:52:45.691806+00:00'::timestamptz);
-- Table: django_session
DROP TABLE IF EXISTS "django_session" CASCADE;
CREATE TABLE "django_session" (
"session_key" VARCHAR(40) NOT NULL,
"session_data" TEXT NOT NULL,
"expire_date" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_session
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('gfkfhw05oct7kit2ke5ajczqw87f149e', '.eJxVjEEOwiAQAP_C2RCgFMGjd99Alt1FqgaS0p6MfzckPeh1ZjJvEWHfStw7r3EhcRFanH5ZAnxyHYIeUO9NYqvbuiQ5EnnYLm-N-HU92r9BgV7GltA7RjNNGYMCRp-0mxw5AyoQOJ9xtqCs0mc0kMgzZafQZORZmWDF5wv8EjiA:1vYT37:QY5dFu5b3NpHb2pzPhSGQ_tdLH2bfEpdqH5vn1ycLiA', '2026-01-07T17:53:25.157543+00:00'::timestamptz);
-- Table: django_site
DROP TABLE IF EXISTS "django_site" CASCADE;
CREATE TABLE "django_site" (
"id" INTEGER NOT NULL,
"domain" VARCHAR(100) NOT NULL,
"name" VARCHAR(50) NOT NULL
);
-- Data for table: django_site
INSERT INTO "django_site" ("id", "domain", "name") VALUES (1, 'example.com', 'example.com');
-- Table: posts
DROP TABLE IF EXISTS "posts" CASCADE;
CREATE TABLE "posts" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"content" TEXT,
"keywords" VARCHAR(254) NOT NULL,
"image" VARCHAR(100),
"video" VARCHAR(254),
"slug" VARCHAR(250) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"is_front" BOOLEAN NOT NULL,
"parent_id" BIGINT
);
-- Table: posts_categories
DROP TABLE IF EXISTS "posts_categories" CASCADE;
CREATE TABLE "posts_categories" (
"id" BIGINT NOT NULL,
"post_id" BIGINT NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: posts_tags
DROP TABLE IF EXISTS "posts_tags" CASCADE;
CREATE TABLE "posts_tags" (
"id" BIGINT NOT NULL,
"post_id" BIGINT NOT NULL,
"tags_id" BIGINT NOT NULL
);
-- Table: settings
DROP TABLE IF EXISTS "settings" CASCADE;
CREATE TABLE "settings" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"meta_title" VARCHAR(254) NOT NULL,
"meta_description" VARCHAR(254) NOT NULL,
"phone" VARCHAR(254) NOT NULL,
"url" VARCHAR(254),
"email" VARCHAR(254) NOT NULL,
"facebook" VARCHAR(254),
"x" VARCHAR(254),
"instagram" VARCHAR(254),
"whatsapp" VARCHAR(254),
"slogan" VARCHAR(254),
"w_logo" VARCHAR(100),
"b_logo" VARCHAR(100),
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Table: social_auth_association
DROP TABLE IF EXISTS "social_auth_association" CASCADE;
CREATE TABLE "social_auth_association" (
"id" BIGINT NOT NULL,
"server_url" VARCHAR(255) NOT NULL,
"handle" VARCHAR(255) NOT NULL,
"secret" VARCHAR(255) NOT NULL,
"issued" INTEGER NOT NULL,
"lifetime" INTEGER NOT NULL,
"assoc_type" VARCHAR(64) NOT NULL
);
-- Table: social_auth_code
DROP TABLE IF EXISTS "social_auth_code" CASCADE;
CREATE TABLE "social_auth_code" (
"id" BIGINT NOT NULL,
"email" VARCHAR(254) NOT NULL,
"code" VARCHAR(32) NOT NULL,
"verified" BOOLEAN NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: social_auth_nonce
DROP TABLE IF EXISTS "social_auth_nonce" CASCADE;
CREATE TABLE "social_auth_nonce" (
"id" BIGINT NOT NULL,
"server_url" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL,
"salt" VARCHAR(65) NOT NULL
);
-- Table: social_auth_partial
DROP TABLE IF EXISTS "social_auth_partial" CASCADE;
CREATE TABLE "social_auth_partial" (
"id" BIGINT NOT NULL,
"token" VARCHAR(32) NOT NULL,
"next_step" SMALLINT NOT NULL,
"backend" VARCHAR(32) NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL,
"data" JSONB NOT NULL
);
-- Table: social_auth_usersocialauth
DROP TABLE IF EXISTS "social_auth_usersocialauth" CASCADE;
CREATE TABLE "social_auth_usersocialauth" (
"id" BIGINT NOT NULL,
"provider" VARCHAR(32) NOT NULL,
"uid" VARCHAR(255) NOT NULL,
"user_id" BIGINT NOT NULL,
"created" TIMESTAMP WITH TIME ZONE NOT NULL,
"modified" TIMESTAMP WITH TIME ZONE NOT NULL,
"extra_data" JSONB NOT NULL
);
-- Table: tags
DROP TABLE IF EXISTS "tags" CASCADE;
CREATE TABLE "tags" (
"id" BIGINT NOT NULL,
"tag" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Reset sequences
SELECT setval('django_migrations_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_migrations"));
SELECT setval('django_content_type_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_content_type"));
SELECT setval('auth_permission_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_permission"));
SELECT setval('auth_group_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group"));
SELECT setval('auth_group_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group_permissions"));
SELECT setval('accounts_customuser_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser"));
SELECT setval('accounts_customuser_groups_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_groups"));
SELECT setval('accounts_customuser_user_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_user_permissions"));
SELECT setval('django_admin_log_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_admin_log"));
SELECT setval('backup_databasebackup_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "backup_databasebackup"));
SELECT setval('tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "tags"));
SELECT setval('categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "categories"));
SELECT setval('posts_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts"));
SELECT setval('posts_categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_categories"));
SELECT setval('posts_tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_tags"));
SELECT setval('category_views_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "category_views"));
SELECT setval('comments_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "comments"));
SELECT setval('banners_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "banners"));
SELECT setval('settings_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "settings"));
SELECT setval('django_site_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_site"));
SELECT setval('social_auth_association_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_association"));
SELECT setval('social_auth_code_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_code"));
SELECT setval('social_auth_nonce_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_nonce"));
SELECT setval('social_auth_usersocialauth_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_usersocialauth"));
SELECT setval('social_auth_partial_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_partial"));

View File

@@ -0,0 +1,694 @@
-- PostgreSQL Database Backup
-- Database: server_dj
-- Date: 2025-12-24 17:57:02.926153
-- Created by Django Backup System using psycopg2
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
-- Table: accounts_customuser
DROP TABLE IF EXISTS "accounts_customuser" CASCADE;
CREATE TABLE "accounts_customuser" (
"id" BIGINT NOT NULL,
"password" VARCHAR(128) NOT NULL,
"last_login" TIMESTAMP WITH TIME ZONE,
"is_superuser" BOOLEAN NOT NULL,
"email" VARCHAR(254) NOT NULL,
"first_name" VARCHAR(150) NOT NULL,
"last_name" VARCHAR(150) NOT NULL,
"is_staff" BOOLEAN NOT NULL,
"is_active" BOOLEAN NOT NULL,
"date_joined" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: accounts_customuser
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (2, 'pbkdf2_sha256$1000000$STRdTwcrx5Zp9jq1AJaBqA$FpygakERoretxVl2gmrcC9LRbfLmBksNXfPOHpUDQIc=', NULL, true, 'admin@example.com', '', '', true, true, '2025-12-23T17:00:07.461106+00:00'::timestamptz);
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (1, 'pbkdf2_sha256$1000000$TuAKB9bCikcDO3QDAzLoMP$yeBkHfoUF+KO5yczuWOAaOyJALWMFg+y8zXgsoXkGcY=', '2025-12-24T17:56:39.320008+00:00'::timestamptz, true, 'beyhan@beyhan.dev', '', '', true, true, '2025-12-22T17:00:19.382231+00:00'::timestamptz);
-- Table: accounts_customuser_groups
DROP TABLE IF EXISTS "accounts_customuser_groups" CASCADE;
CREATE TABLE "accounts_customuser_groups" (
"id" BIGINT NOT NULL,
"customuser_id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL
);
-- Table: accounts_customuser_user_permissions
DROP TABLE IF EXISTS "accounts_customuser_user_permissions" CASCADE;
CREATE TABLE "accounts_customuser_user_permissions" (
"id" BIGINT NOT NULL,
"customuser_id" BIGINT NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_group
DROP TABLE IF EXISTS "auth_group" CASCADE;
CREATE TABLE "auth_group" (
"id" INTEGER NOT NULL,
"name" VARCHAR(150) NOT NULL
);
-- Table: auth_group_permissions
DROP TABLE IF EXISTS "auth_group_permissions" CASCADE;
CREATE TABLE "auth_group_permissions" (
"id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_permission
DROP TABLE IF EXISTS "auth_permission" CASCADE;
CREATE TABLE "auth_permission" (
"id" INTEGER NOT NULL,
"name" VARCHAR(255) NOT NULL,
"content_type_id" INTEGER NOT NULL,
"codename" VARCHAR(100) NOT NULL
);
-- Data for table: auth_permission
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (1, 'Can add log entry', 1, 'add_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (2, 'Can change log entry', 1, 'change_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (3, 'Can delete log entry', 1, 'delete_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (4, 'Can view log entry', 1, 'view_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (5, 'Can add permission', 3, 'add_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (6, 'Can change permission', 3, 'change_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (7, 'Can delete permission', 3, 'delete_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (8, 'Can view permission', 3, 'view_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (9, 'Can add group', 2, 'add_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (10, 'Can change group', 2, 'change_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (11, 'Can delete group', 2, 'delete_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (12, 'Can view group', 2, 'view_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (13, 'Can add content type', 4, 'add_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (14, 'Can change content type', 4, 'change_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (15, 'Can delete content type', 4, 'delete_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (16, 'Can view content type', 4, 'view_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (17, 'Can add session', 5, 'add_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (18, 'Can change session', 5, 'change_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (19, 'Can delete session', 5, 'delete_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (20, 'Can view session', 5, 'view_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (21, 'Can add association', 6, 'add_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (22, 'Can change association', 6, 'change_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (23, 'Can delete association', 6, 'delete_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (24, 'Can view association', 6, 'view_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (25, 'Can add code', 7, 'add_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (26, 'Can change code', 7, 'change_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (27, 'Can delete code', 7, 'delete_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (28, 'Can view code', 7, 'view_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (29, 'Can add nonce', 8, 'add_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (30, 'Can change nonce', 8, 'change_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (31, 'Can delete nonce', 8, 'delete_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (32, 'Can view nonce', 8, 'view_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (33, 'Can add user social auth', 10, 'add_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (34, 'Can change user social auth', 10, 'change_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (35, 'Can delete user social auth', 10, 'delete_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (36, 'Can view user social auth', 10, 'view_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (37, 'Can add partial', 9, 'add_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (38, 'Can change partial', 9, 'change_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (39, 'Can delete partial', 9, 'delete_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (40, 'Can view partial', 9, 'view_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (41, 'Can add site', 11, 'add_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (42, 'Can change site', 11, 'change_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (43, 'Can delete site', 11, 'delete_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (44, 'Can view site', 11, 'view_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (45, 'Can add user', 12, 'add_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (46, 'Can change user', 12, 'change_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (47, 'Can delete user', 12, 'delete_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (48, 'Can view user', 12, 'view_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (49, 'Can add Banner', 13, 'add_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (50, 'Can change Banner', 13, 'change_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (51, 'Can delete Banner', 13, 'delete_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (52, 'Can view Banner', 13, 'view_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (53, 'Can add Site Ayarı', 14, 'add_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (54, 'Can change Site Ayarı', 14, 'change_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (55, 'Can delete Site Ayarı', 14, 'delete_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (56, 'Can view Site Ayarı', 14, 'view_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (57, 'Can add Post Tagı', 19, 'add_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (58, 'Can change Post Tagı', 19, 'change_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (59, 'Can delete Post Tagı', 19, 'delete_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (60, 'Can view Post Tagı', 19, 'view_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (61, 'Can add Post Kategori', 15, 'add_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (62, 'Can change Post Kategori', 15, 'change_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (63, 'Can delete Post Kategori', 15, 'delete_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (64, 'Can view Post Kategori', 15, 'view_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (65, 'Can add Post', 18, 'add_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (66, 'Can change Post', 18, 'change_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (67, 'Can delete Post', 18, 'delete_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (68, 'Can view Post', 18, 'view_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (69, 'Can add Kategori Ziyareti', 16, 'add_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (70, 'Can change Kategori Ziyareti', 16, 'change_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (71, 'Can delete Kategori Ziyareti', 16, 'delete_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (72, 'Can view Kategori Ziyareti', 16, 'view_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (73, 'Can add Post Yorum', 17, 'add_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (74, 'Can change Post Yorum', 17, 'change_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (75, 'Can delete Post Yorum', 17, 'delete_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (76, 'Can view Post Yorum', 17, 'view_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (77, 'Can add Veritabanı Yedeği', 20, 'add_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (78, 'Can change Veritabanı Yedeği', 20, 'change_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (79, 'Can delete Veritabanı Yedeği', 20, 'delete_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (80, 'Can view Veritabanı Yedeği', 20, 'view_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (81, 'Can add crontab', 21, 'add_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (82, 'Can change crontab', 21, 'change_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (83, 'Can delete crontab', 21, 'delete_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (84, 'Can view crontab', 21, 'view_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (85, 'Can add interval', 22, 'add_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (86, 'Can change interval', 22, 'change_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (87, 'Can delete interval', 22, 'delete_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (88, 'Can view interval', 22, 'view_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (89, 'Can add periodic task', 23, 'add_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (90, 'Can change periodic task', 23, 'change_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (91, 'Can delete periodic task', 23, 'delete_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (92, 'Can view periodic task', 23, 'view_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (93, 'Can add periodic task track', 24, 'add_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (94, 'Can change periodic task track', 24, 'change_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (95, 'Can delete periodic task track', 24, 'delete_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (96, 'Can view periodic task track', 24, 'view_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (97, 'Can add solar event', 25, 'add_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (98, 'Can change solar event', 25, 'change_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (99, 'Can delete solar event', 25, 'delete_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (100, 'Can view solar event', 25, 'view_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (101, 'Can add clocked', 26, 'add_clockedschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (102, 'Can change clocked', 26, 'change_clockedschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (103, 'Can delete clocked', 26, 'delete_clockedschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (104, 'Can view clocked', 26, 'view_clockedschedule');
-- Table: backup_databasebackup
DROP TABLE IF EXISTS "backup_databasebackup" CASCADE;
CREATE TABLE "backup_databasebackup" (
"id" BIGINT NOT NULL,
"name" VARCHAR(255) NOT NULL,
"file_path" VARCHAR(500),
"file_size" BIGINT,
"status" VARCHAR(20) NOT NULL,
"backup_type" VARCHAR(20) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"completed_at" TIMESTAMP WITH TIME ZONE,
"error_message" TEXT,
"notes" TEXT,
"created_by_id" BIGINT
);
-- Data for table: backup_databasebackup
INSERT INTO "backup_databasebackup" ("id", "name", "file_path", "file_size", "status", "backup_type", "created_at", "completed_at", "error_message", "notes", "created_by_id") VALUES (28, 'Manuel Yedek - 2025-12-24 17:57:02', NULL, NULL, 'in_progress', 'manual', '2025-12-24T17:57:02.880561+00:00'::timestamptz, NULL, NULL, NULL, 1);
-- Table: banners
DROP TABLE IF EXISTS "banners" CASCADE;
CREATE TABLE "banners" (
"id" BIGINT NOT NULL,
"color" VARCHAR(25) NOT NULL,
"title" VARCHAR(254),
"text1" VARCHAR(254),
"text2" VARCHAR(254),
"text4" VARCHAR(254),
"text5" VARCHAR(254),
"image" VARCHAR(100) NOT NULL,
"image_k" VARCHAR(100),
"image_k_txt" VARCHAR(254),
"is_active" BOOLEAN NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: categories
DROP TABLE IF EXISTS "categories" CASCADE;
CREATE TABLE "categories" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"keywords" VARCHAR(254) NOT NULL,
"description" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"order" INTEGER NOT NULL,
"slug" VARCHAR(250) NOT NULL,
"image" VARCHAR(100),
"parent_id" BIGINT
);
-- Table: category_views
DROP TABLE IF EXISTS "category_views" CASCADE;
CREATE TABLE "category_views" (
"id" BIGINT NOT NULL,
"ip_address" INET NOT NULL,
"user_agent" TEXT,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: comments
DROP TABLE IF EXISTS "comments" CASCADE;
CREATE TABLE "comments" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"body" TEXT NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"slug" VARCHAR(50) NOT NULL,
"parent_id" BIGINT,
"user_id" BIGINT NOT NULL,
"product_id" BIGINT NOT NULL
);
-- Table: django_admin_log
DROP TABLE IF EXISTS "django_admin_log" CASCADE;
CREATE TABLE "django_admin_log" (
"id" INTEGER NOT NULL,
"action_time" TIMESTAMP WITH TIME ZONE NOT NULL,
"object_id" TEXT,
"object_repr" VARCHAR(200) NOT NULL,
"action_flag" SMALLINT NOT NULL,
"change_message" TEXT NOT NULL,
"content_type_id" INTEGER,
"user_id" BIGINT NOT NULL
);
-- Data for table: django_admin_log
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (1, '2025-12-22T17:00:54.961166+00:00'::timestamptz, '1', 'Yedek 1 - Bekliyor', 1, '[{"added": {}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (2, '2025-12-22T17:01:10.019183+00:00'::timestamptz, '1', 'Yedek 1 - Bekliyor', 2, '[]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (3, '2025-12-22T17:08:18.352881+00:00'::timestamptz, '2', 'Manuel Yedek - 2025-12-22 17:01:15 - Başarısız', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (4, '2025-12-22T17:08:25.284922+00:00'::timestamptz, '4', 'Manuel Yedek - 2025-12-22 17:05:18 - Başarısız', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (5, '2025-12-22T17:08:30.992298+00:00'::timestamptz, '3', 'Manuel Yedek - 2025-12-22 17:03:41 - Başarısız', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (6, '2025-12-22T17:08:56.836202+00:00'::timestamptz, '5', 'Manuel Yedek - 2025-12-22 17:06:15 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (7, '2025-12-22T17:32:09.624013+00:00'::timestamptz, '7', 'Manuel Yedek - 2025-12-22 17:30:14 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (8, '2025-12-22T17:32:15.437591+00:00'::timestamptz, '6', 'Manuel Yedek - 2025-12-22 17:09:20 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (9, '2025-12-22T17:35:52.413394+00:00'::timestamptz, '8', 'Manuel Yedek - 2025-12-22 17:32:27 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (10, '2025-12-22T18:03:49.897584+00:00'::timestamptz, '13', 'Manuel Yedek - 2025-12-22 17:50:15 - Tamamlandı', 2, '[{"changed": {"fields": ["Yedek Tipi"]}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (11, '2025-12-22T18:08:37.961862+00:00'::timestamptz, '11', 'Manuel Yedek - 2025-12-22 17:38:03 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (12, '2025-12-22T18:08:57.986969+00:00'::timestamptz, '14', 'Manuel Yedek - 2025-12-22 18:07:38 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (13, '2025-12-22T18:09:03.531449+00:00'::timestamptz, '12', 'Manuel Yedek - 2025-12-22 17:43:28 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (14, '2025-12-22T18:09:17.538540+00:00'::timestamptz, '13', 'Manuel Yedek - 2025-12-22 17:50:15 - Tamamlandı', 2, '[{"changed": {"fields": ["Yedek Tipi"]}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (15, '2025-12-22T18:34:40.618018+00:00'::timestamptz, '16', 'Manuel Yedek - 2025-12-22 18:33:20 - Bekliyor', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (16, '2025-12-23T17:01:26.647467+00:00'::timestamptz, '18', 'Manuel Yedek - 2025-12-23 17:00:47 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (17, '2025-12-23T17:01:38.828269+00:00'::timestamptz, '17', 'Manuel Yedek - 2025-12-22 18:34:13 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (18, '2025-12-23T17:01:43.823658+00:00'::timestamptz, '15', 'Manuel Yedek - 2025-12-22 18:09:22 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (19, '2025-12-23T17:01:54.835538+00:00'::timestamptz, '13', 'Manuel Yedek - 2025-12-22 17:50:15 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (20, '2025-12-23T17:02:16.355915+00:00'::timestamptz, '19', 'Yedek Al - Bekliyor', 1, '[{"added": {}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (21, '2025-12-24T15:12:30.215650+00:00'::timestamptz, '20', 'Manuel Yedek - 2025-12-23 17:02:44 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (22, '2025-12-24T15:13:08.133128+00:00'::timestamptz, '21', 'Manuel Yedek - 2025-12-24 15:12:38 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (23, '2025-12-24T15:14:20.197452+00:00'::timestamptz, '22', 'Manuel Yedek - 2025-12-24 15:13:32 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (24, '2025-12-24T15:21:35.234189+00:00'::timestamptz, '23', 'Manuel Yedek - 2025-12-24 15:21:11 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (25, '2025-12-24T15:25:09.589932+00:00'::timestamptz, '19', 'Yedek Al - Bekliyor', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (26, '2025-12-24T17:56:51.486638+00:00'::timestamptz, '27', 'Yüklenen Yedek - backup_server_dj_20251224_152152_test - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (27, '2025-12-24T17:56:51.486802+00:00'::timestamptz, '26', 'Manuel Yedek - 2025-12-24 15:28:28 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (28, '2025-12-24T17:56:51.486909+00:00'::timestamptz, '25', 'Manuel Yedek - 2025-12-24 15:26:24 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (29, '2025-12-24T17:56:51.487012+00:00'::timestamptz, '24', 'Manuel Yedek - 2025-12-24 15:21:52 - Tamamlandı', 3, '', 20, 1);
-- Table: django_celery_beat_clockedschedule
DROP TABLE IF EXISTS "django_celery_beat_clockedschedule" CASCADE;
CREATE TABLE "django_celery_beat_clockedschedule" (
"id" INTEGER NOT NULL,
"clocked_time" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: django_celery_beat_crontabschedule
DROP TABLE IF EXISTS "django_celery_beat_crontabschedule" CASCADE;
CREATE TABLE "django_celery_beat_crontabschedule" (
"id" INTEGER NOT NULL,
"minute" VARCHAR(240) NOT NULL,
"hour" VARCHAR(96) NOT NULL,
"day_of_week" VARCHAR(64) NOT NULL,
"day_of_month" VARCHAR(124) NOT NULL,
"month_of_year" VARCHAR(64) NOT NULL,
"timezone" VARCHAR(63) NOT NULL
);
-- Table: django_celery_beat_intervalschedule
DROP TABLE IF EXISTS "django_celery_beat_intervalschedule" CASCADE;
CREATE TABLE "django_celery_beat_intervalschedule" (
"id" INTEGER NOT NULL,
"every" INTEGER NOT NULL,
"period" VARCHAR(24) NOT NULL
);
-- Table: django_celery_beat_periodictask
DROP TABLE IF EXISTS "django_celery_beat_periodictask" CASCADE;
CREATE TABLE "django_celery_beat_periodictask" (
"id" INTEGER NOT NULL,
"name" VARCHAR(200) NOT NULL,
"task" VARCHAR(200) NOT NULL,
"args" TEXT NOT NULL,
"kwargs" TEXT NOT NULL,
"queue" VARCHAR(200),
"exchange" VARCHAR(200),
"routing_key" VARCHAR(200),
"expires" TIMESTAMP WITH TIME ZONE,
"enabled" BOOLEAN NOT NULL,
"last_run_at" TIMESTAMP WITH TIME ZONE,
"total_run_count" INTEGER NOT NULL,
"date_changed" TIMESTAMP WITH TIME ZONE NOT NULL,
"description" TEXT NOT NULL,
"crontab_id" INTEGER,
"interval_id" INTEGER,
"solar_id" INTEGER,
"one_off" BOOLEAN NOT NULL,
"start_time" TIMESTAMP WITH TIME ZONE,
"priority" INTEGER,
"headers" TEXT NOT NULL,
"clocked_id" INTEGER,
"expire_seconds" INTEGER
);
-- Table: django_celery_beat_periodictasks
DROP TABLE IF EXISTS "django_celery_beat_periodictasks" CASCADE;
CREATE TABLE "django_celery_beat_periodictasks" (
"ident" SMALLINT NOT NULL,
"last_update" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: django_celery_beat_solarschedule
DROP TABLE IF EXISTS "django_celery_beat_solarschedule" CASCADE;
CREATE TABLE "django_celery_beat_solarschedule" (
"id" INTEGER NOT NULL,
"event" VARCHAR(24) NOT NULL,
"latitude" NUMERIC NOT NULL,
"longitude" NUMERIC NOT NULL
);
-- Table: django_content_type
DROP TABLE IF EXISTS "django_content_type" CASCADE;
CREATE TABLE "django_content_type" (
"id" INTEGER NOT NULL,
"app_label" VARCHAR(100) NOT NULL,
"model" VARCHAR(100) NOT NULL
);
-- Data for table: django_content_type
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (1, 'admin', 'logentry');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (2, 'auth', 'group');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (3, 'auth', 'permission');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (4, 'contenttypes', 'contenttype');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (5, 'sessions', 'session');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (6, 'social_django', 'association');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (7, 'social_django', 'code');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (8, 'social_django', 'nonce');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (9, 'social_django', 'partial');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (10, 'social_django', 'usersocialauth');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (11, 'sites', 'site');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (12, 'accounts', 'customuser');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (13, 'settings', 'banner');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (14, 'settings', 'setting');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (15, 'blog', 'category');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (16, 'blog', 'categoryview');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (17, 'blog', 'comment');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (18, 'blog', 'post');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (19, 'blog', 'tags');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (20, 'backup', 'databasebackup');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (21, 'django_celery_beat', 'crontabschedule');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (22, 'django_celery_beat', 'intervalschedule');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (23, 'django_celery_beat', 'periodictask');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (24, 'django_celery_beat', 'periodictasks');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (25, 'django_celery_beat', 'solarschedule');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (26, 'django_celery_beat', 'clockedschedule');
-- Table: django_migrations
DROP TABLE IF EXISTS "django_migrations" CASCADE;
CREATE TABLE "django_migrations" (
"id" BIGINT NOT NULL,
"app" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"applied" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_migrations
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (1, 'contenttypes', '0001_initial', '2025-12-22T16:57:19.217932+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (2, 'contenttypes', '0002_remove_content_type_name', '2025-12-22T16:57:19.234555+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (3, 'auth', '0001_initial', '2025-12-22T16:57:19.434147+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (4, 'auth', '0002_alter_permission_name_max_length', '2025-12-22T16:57:19.446206+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (5, 'auth', '0003_alter_user_email_max_length', '2025-12-22T16:57:19.455809+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (6, 'auth', '0004_alter_user_username_opts', '2025-12-22T16:57:19.465593+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (7, 'auth', '0005_alter_user_last_login_null', '2025-12-22T16:57:19.475691+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (8, 'auth', '0006_require_contenttypes_0002', '2025-12-22T16:57:19.481434+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (9, 'auth', '0007_alter_validators_add_error_messages', '2025-12-22T16:57:19.565856+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (10, 'auth', '0008_alter_user_username_max_length', '2025-12-22T16:57:19.592172+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (11, 'auth', '0009_alter_user_last_name_max_length', '2025-12-22T16:57:19.603096+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (12, 'auth', '0010_alter_group_name_max_length', '2025-12-22T16:57:19.625591+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (13, 'auth', '0011_update_proxy_permissions', '2025-12-22T16:57:19.634914+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (14, 'auth', '0012_alter_user_first_name_max_length', '2025-12-22T16:57:19.645268+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (15, 'accounts', '0001_initial', '2025-12-22T16:57:19.898703+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (16, 'admin', '0001_initial', '2025-12-22T16:57:19.967758+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (17, 'admin', '0002_logentry_remove_auto_add', '2025-12-22T16:57:19.980668+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (18, 'admin', '0003_logentry_add_action_flag_choices', '2025-12-22T16:57:19.994932+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (19, 'backup', '0001_initial', '2025-12-22T16:57:20.047172+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (20, 'blog', '0001_initial', '2025-12-22T16:57:20.451373+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (21, 'sessions', '0001_initial', '2025-12-22T16:57:20.596961+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (22, 'settings', '0001_initial', '2025-12-22T16:57:20.623314+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (23, 'sites', '0001_initial', '2025-12-22T16:57:20.634939+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (24, 'sites', '0002_alter_domain_unique', '2025-12-22T16:57:20.648215+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (25, 'default', '0001_initial', '2025-12-22T16:57:20.743912+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (26, 'social_auth', '0001_initial', '2025-12-22T16:57:20.747238+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (27, 'social_django', '0001_initial', '2025-12-22T16:57:20.750337+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (28, 'default', '0002_add_related_name', '2025-12-22T16:57:20.772416+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (29, 'social_auth', '0002_add_related_name', '2025-12-22T16:57:20.776564+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (30, 'social_django', '0002_add_related_name', '2025-12-22T16:57:20.778681+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (31, 'default', '0003_alter_email_max_length', '2025-12-22T16:57:20.797950+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (32, 'social_auth', '0003_alter_email_max_length', '2025-12-22T16:57:20.800526+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (33, 'social_django', '0003_alter_email_max_length', '2025-12-22T16:57:20.802697+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (34, 'default', '0004_auto_20160423_0400', '2025-12-22T16:57:20.818189+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (35, 'social_auth', '0004_auto_20160423_0400', '2025-12-22T16:57:20.821978+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (36, 'social_django', '0004_auto_20160423_0400', '2025-12-22T16:57:20.824686+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (37, 'social_auth', '0005_auto_20160727_2333', '2025-12-22T16:57:20.838781+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (38, 'social_django', '0005_auto_20160727_2333', '2025-12-22T16:57:20.842005+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (39, 'social_django', '0006_partial', '2025-12-22T16:57:20.882162+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (40, 'social_django', '0007_code_timestamp', '2025-12-22T16:57:21.016558+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (41, 'social_django', '0008_partial_timestamp', '2025-12-22T16:57:21.036847+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (42, 'social_django', '0009_auto_20191118_0520', '2025-12-22T16:57:21.078912+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (43, 'social_django', '0010_uid_db_index', '2025-12-22T16:57:21.103380+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (44, 'social_django', '0011_alter_id_fields', '2025-12-22T16:57:21.271476+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (45, 'social_django', '0012_usersocialauth_extra_data_new', '2025-12-22T16:57:21.315237+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (46, 'social_django', '0013_migrate_extra_data', '2025-12-22T16:57:21.359048+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (47, 'social_django', '0014_remove_usersocialauth_extra_data', '2025-12-22T16:57:21.387186+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (48, 'social_django', '0015_rename_extra_data_new_usersocialauth_extra_data', '2025-12-22T16:57:21.411254+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (49, 'social_django', '0016_alter_usersocialauth_extra_data', '2025-12-22T16:57:21.425493+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (50, 'social_django', '0017_usersocialauth_user_social_auth_uid_required', '2025-12-22T16:57:21.447520+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (51, 'django_celery_beat', '0001_initial', '2025-12-22T17:29:12.618773+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (52, 'django_celery_beat', '0002_auto_20161118_0346', '2025-12-22T17:29:12.644272+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (53, 'django_celery_beat', '0003_auto_20161209_0049', '2025-12-22T17:29:12.661945+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (54, 'django_celery_beat', '0004_auto_20170221_0000', '2025-12-22T17:29:12.669274+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (55, 'django_celery_beat', '0005_add_solarschedule_events_choices', '2025-12-22T17:29:12.678019+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (56, 'django_celery_beat', '0006_auto_20180322_0932', '2025-12-22T17:29:12.752211+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (57, 'django_celery_beat', '0007_auto_20180521_0826', '2025-12-22T17:29:12.793017+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (58, 'django_celery_beat', '0008_auto_20180914_1922', '2025-12-22T17:29:12.831420+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (59, 'django_celery_beat', '0006_auto_20180210_1226', '2025-12-22T17:29:12.856887+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (60, 'django_celery_beat', '0006_periodictask_priority', '2025-12-22T17:29:12.877901+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (61, 'django_celery_beat', '0009_periodictask_headers', '2025-12-22T17:29:12.902729+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (62, 'django_celery_beat', '0010_auto_20190429_0326', '2025-12-22T17:29:13.109071+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (63, 'django_celery_beat', '0011_auto_20190508_0153', '2025-12-22T17:29:13.153527+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (64, 'django_celery_beat', '0012_periodictask_expire_seconds', '2025-12-22T17:29:13.170247+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (65, 'django_celery_beat', '0013_auto_20200609_0727', '2025-12-22T17:29:13.182913+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (66, 'django_celery_beat', '0014_remove_clockedschedule_enabled', '2025-12-22T17:29:13.197676+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (67, 'django_celery_beat', '0015_edit_solarschedule_events_choices', '2025-12-22T17:29:13.207482+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (68, 'django_celery_beat', '0016_alter_crontabschedule_timezone', '2025-12-22T17:29:13.224397+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (69, 'django_celery_beat', '0017_alter_crontabschedule_month_of_year', '2025-12-22T17:29:13.238625+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (70, 'django_celery_beat', '0018_improve_crontab_helptext', '2025-12-22T17:29:13.252445+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (71, 'django_celery_beat', '0019_alter_periodictasks_options', '2025-12-22T17:29:13.259425+00:00'::timestamptz);
-- Table: django_session
DROP TABLE IF EXISTS "django_session" CASCADE;
CREATE TABLE "django_session" (
"session_key" VARCHAR(40) NOT NULL,
"session_data" TEXT NOT NULL,
"expire_date" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_session
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('e7jyr13wedmqdkjukqb35t2pyylkbvwz', '.eJxVjEEOwiAQRe_C2hBgpKBL9z0DmWFGqRpISrsy3l2bdKHb_977L5VwXUpau8xpYnVWVh1-N8L8kLoBvmO9NZ1bXeaJ9KbonXY9NpbnZXf_Dgr28q0F0bKTEGNG70Uie8vgLbGBYxQbwBHlwQ0szoILOQsDwMmZeKVgvHp_APiKN_E:1vXjGo:c9NPOwqzmQXV6RsDHkclP-w4ogI8VDPbV0KQilsiW6Y', '2026-01-05T17:00:30.494599+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('thlq90xyxsfsbjaps7tlga1dnluq990o', '.eJxVjDsOwjAQBe_iGllr2PhDSZ8zWOtdBweQI8VJhbg7iZQC2pl5760irUuJa8tzHEVdlVGnX5aIn7nuQh5U75PmqS7zmPSe6MM23U-SX7ej_Tso1Mq2JnSIDJkGAugMIzln_AbBnhFckMA8UELxRB7RYLCA4tgG6QT4oj5f0K43Zw:1vY5kS:rh1Px0710ffBgpJaxxgDsDyvhjpMKdKLRmAxhKHJuqg', '2026-01-06T17:00:36.697289+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('xgwdpmw5guv7ygdfh5hn8s7njr1m8q54', '.eJxVjDsOwjAQBe_iGllr2PhDSZ8zWOtdBweQI8VJhbg7iZQC2pl5760irUuJa8tzHEVdlVGnX5aIn7nuQh5U75PmqS7zmPSe6MM23U-SX7ej_Tso1Mq2JnSIDJkGAugMIzln_AbBnhFckMA8UELxRB7RYLCA4tgG6QT4oj5f0K43Zw:1vYQXF:plw9RHnEzpCK5mUlnVbLTCLYkvx4NS29nPXM1OQT6yE', '2026-01-07T15:12:21.391215+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('8f1g3xhmdt9xwwyvlo3ozn57680zvlot', '.eJxVjDsOwjAQBe_iGllr2PhDSZ8zWOtdBweQI8VJhbg7iZQC2pl5760irUuJa8tzHEVdlVGnX5aIn7nuQh5U75PmqS7zmPSe6MM23U-SX7ej_Tso1Mq2JnSIDJkGAugMIzln_AbBnhFckMA8UELxRB7RYLCA4tgG6QT4oj5f0K43Zw:1vYT6F:5kBYD8TaD8dIBBcU6UwIVZCYGUwgGCe4IjA1ruLwbrw', '2026-01-07T17:56:39.326481+00:00'::timestamptz);
-- Table: django_site
DROP TABLE IF EXISTS "django_site" CASCADE;
CREATE TABLE "django_site" (
"id" INTEGER NOT NULL,
"domain" VARCHAR(100) NOT NULL,
"name" VARCHAR(50) NOT NULL
);
-- Data for table: django_site
INSERT INTO "django_site" ("id", "domain", "name") VALUES (1, 'example.com', 'example.com');
-- Table: posts
DROP TABLE IF EXISTS "posts" CASCADE;
CREATE TABLE "posts" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"content" TEXT,
"keywords" VARCHAR(254) NOT NULL,
"image" VARCHAR(100),
"video" VARCHAR(254),
"slug" VARCHAR(250) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"is_front" BOOLEAN NOT NULL,
"parent_id" BIGINT
);
-- Table: posts_categories
DROP TABLE IF EXISTS "posts_categories" CASCADE;
CREATE TABLE "posts_categories" (
"id" BIGINT NOT NULL,
"post_id" BIGINT NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: posts_tags
DROP TABLE IF EXISTS "posts_tags" CASCADE;
CREATE TABLE "posts_tags" (
"id" BIGINT NOT NULL,
"post_id" BIGINT NOT NULL,
"tags_id" BIGINT NOT NULL
);
-- Table: settings
DROP TABLE IF EXISTS "settings" CASCADE;
CREATE TABLE "settings" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"meta_title" VARCHAR(254) NOT NULL,
"meta_description" VARCHAR(254) NOT NULL,
"phone" VARCHAR(254) NOT NULL,
"url" VARCHAR(254),
"email" VARCHAR(254) NOT NULL,
"facebook" VARCHAR(254),
"x" VARCHAR(254),
"instagram" VARCHAR(254),
"whatsapp" VARCHAR(254),
"slogan" VARCHAR(254),
"w_logo" VARCHAR(100),
"b_logo" VARCHAR(100),
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Table: social_auth_association
DROP TABLE IF EXISTS "social_auth_association" CASCADE;
CREATE TABLE "social_auth_association" (
"id" BIGINT NOT NULL,
"server_url" VARCHAR(255) NOT NULL,
"handle" VARCHAR(255) NOT NULL,
"secret" VARCHAR(255) NOT NULL,
"issued" INTEGER NOT NULL,
"lifetime" INTEGER NOT NULL,
"assoc_type" VARCHAR(64) NOT NULL
);
-- Table: social_auth_code
DROP TABLE IF EXISTS "social_auth_code" CASCADE;
CREATE TABLE "social_auth_code" (
"id" BIGINT NOT NULL,
"email" VARCHAR(254) NOT NULL,
"code" VARCHAR(32) NOT NULL,
"verified" BOOLEAN NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: social_auth_nonce
DROP TABLE IF EXISTS "social_auth_nonce" CASCADE;
CREATE TABLE "social_auth_nonce" (
"id" BIGINT NOT NULL,
"server_url" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL,
"salt" VARCHAR(65) NOT NULL
);
-- Table: social_auth_partial
DROP TABLE IF EXISTS "social_auth_partial" CASCADE;
CREATE TABLE "social_auth_partial" (
"id" BIGINT NOT NULL,
"token" VARCHAR(32) NOT NULL,
"next_step" SMALLINT NOT NULL,
"backend" VARCHAR(32) NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL,
"data" JSONB NOT NULL
);
-- Table: social_auth_usersocialauth
DROP TABLE IF EXISTS "social_auth_usersocialauth" CASCADE;
CREATE TABLE "social_auth_usersocialauth" (
"id" BIGINT NOT NULL,
"provider" VARCHAR(32) NOT NULL,
"uid" VARCHAR(255) NOT NULL,
"user_id" BIGINT NOT NULL,
"created" TIMESTAMP WITH TIME ZONE NOT NULL,
"modified" TIMESTAMP WITH TIME ZONE NOT NULL,
"extra_data" JSONB NOT NULL
);
-- Table: tags
DROP TABLE IF EXISTS "tags" CASCADE;
CREATE TABLE "tags" (
"id" BIGINT NOT NULL,
"tag" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Reset sequences
SELECT setval('django_migrations_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_migrations"));
SELECT setval('django_content_type_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_content_type"));
SELECT setval('auth_permission_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_permission"));
SELECT setval('auth_group_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group"));
SELECT setval('auth_group_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group_permissions"));
SELECT setval('accounts_customuser_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser"));
SELECT setval('accounts_customuser_groups_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_groups"));
SELECT setval('accounts_customuser_user_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_user_permissions"));
SELECT setval('django_admin_log_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_admin_log"));
SELECT setval('backup_databasebackup_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "backup_databasebackup"));
SELECT setval('tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "tags"));
SELECT setval('categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "categories"));
SELECT setval('posts_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts"));
SELECT setval('posts_categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_categories"));
SELECT setval('posts_tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_tags"));
SELECT setval('category_views_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "category_views"));
SELECT setval('comments_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "comments"));
SELECT setval('banners_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "banners"));
SELECT setval('settings_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "settings"));
SELECT setval('django_site_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_site"));
SELECT setval('social_auth_association_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_association"));
SELECT setval('social_auth_code_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_code"));
SELECT setval('social_auth_nonce_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_nonce"));
SELECT setval('social_auth_usersocialauth_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_usersocialauth"));
SELECT setval('social_auth_partial_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_partial"));
SELECT setval('django_celery_beat_crontabschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_crontabschedule"));
SELECT setval('django_celery_beat_intervalschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_intervalschedule"));
SELECT setval('django_celery_beat_periodictask_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_periodictask"));
SELECT setval('django_celery_beat_solarschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_solarschedule"));
SELECT setval('django_celery_beat_clockedschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_clockedschedule"));

View File

@@ -0,0 +1,694 @@
-- PostgreSQL Database Backup
-- Database: server_dj
-- Date: 2025-12-24 17:57:02.926153
-- Created by Django Backup System using psycopg2
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
-- Table: accounts_customuser
DROP TABLE IF EXISTS "accounts_customuser" CASCADE;
CREATE TABLE "accounts_customuser" (
"id" BIGINT NOT NULL,
"password" VARCHAR(128) NOT NULL,
"last_login" TIMESTAMP WITH TIME ZONE,
"is_superuser" BOOLEAN NOT NULL,
"email" VARCHAR(254) NOT NULL,
"first_name" VARCHAR(150) NOT NULL,
"last_name" VARCHAR(150) NOT NULL,
"is_staff" BOOLEAN NOT NULL,
"is_active" BOOLEAN NOT NULL,
"date_joined" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: accounts_customuser
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (2, 'pbkdf2_sha256$1000000$STRdTwcrx5Zp9jq1AJaBqA$FpygakERoretxVl2gmrcC9LRbfLmBksNXfPOHpUDQIc=', NULL, true, 'admin@example.com', '', '', true, true, '2025-12-23T17:00:07.461106+00:00'::timestamptz);
INSERT INTO "accounts_customuser" ("id", "password", "last_login", "is_superuser", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined") VALUES (1, 'pbkdf2_sha256$1000000$TuAKB9bCikcDO3QDAzLoMP$yeBkHfoUF+KO5yczuWOAaOyJALWMFg+y8zXgsoXkGcY=', '2025-12-24T17:56:39.320008+00:00'::timestamptz, true, 'beyhan@beyhan.dev', '', '', true, true, '2025-12-22T17:00:19.382231+00:00'::timestamptz);
-- Table: accounts_customuser_groups
DROP TABLE IF EXISTS "accounts_customuser_groups" CASCADE;
CREATE TABLE "accounts_customuser_groups" (
"id" BIGINT NOT NULL,
"customuser_id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL
);
-- Table: accounts_customuser_user_permissions
DROP TABLE IF EXISTS "accounts_customuser_user_permissions" CASCADE;
CREATE TABLE "accounts_customuser_user_permissions" (
"id" BIGINT NOT NULL,
"customuser_id" BIGINT NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_group
DROP TABLE IF EXISTS "auth_group" CASCADE;
CREATE TABLE "auth_group" (
"id" INTEGER NOT NULL,
"name" VARCHAR(150) NOT NULL
);
-- Table: auth_group_permissions
DROP TABLE IF EXISTS "auth_group_permissions" CASCADE;
CREATE TABLE "auth_group_permissions" (
"id" BIGINT NOT NULL,
"group_id" INTEGER NOT NULL,
"permission_id" INTEGER NOT NULL
);
-- Table: auth_permission
DROP TABLE IF EXISTS "auth_permission" CASCADE;
CREATE TABLE "auth_permission" (
"id" INTEGER NOT NULL,
"name" VARCHAR(255) NOT NULL,
"content_type_id" INTEGER NOT NULL,
"codename" VARCHAR(100) NOT NULL
);
-- Data for table: auth_permission
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (1, 'Can add log entry', 1, 'add_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (2, 'Can change log entry', 1, 'change_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (3, 'Can delete log entry', 1, 'delete_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (4, 'Can view log entry', 1, 'view_logentry');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (5, 'Can add permission', 3, 'add_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (6, 'Can change permission', 3, 'change_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (7, 'Can delete permission', 3, 'delete_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (8, 'Can view permission', 3, 'view_permission');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (9, 'Can add group', 2, 'add_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (10, 'Can change group', 2, 'change_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (11, 'Can delete group', 2, 'delete_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (12, 'Can view group', 2, 'view_group');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (13, 'Can add content type', 4, 'add_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (14, 'Can change content type', 4, 'change_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (15, 'Can delete content type', 4, 'delete_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (16, 'Can view content type', 4, 'view_contenttype');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (17, 'Can add session', 5, 'add_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (18, 'Can change session', 5, 'change_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (19, 'Can delete session', 5, 'delete_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (20, 'Can view session', 5, 'view_session');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (21, 'Can add association', 6, 'add_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (22, 'Can change association', 6, 'change_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (23, 'Can delete association', 6, 'delete_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (24, 'Can view association', 6, 'view_association');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (25, 'Can add code', 7, 'add_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (26, 'Can change code', 7, 'change_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (27, 'Can delete code', 7, 'delete_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (28, 'Can view code', 7, 'view_code');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (29, 'Can add nonce', 8, 'add_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (30, 'Can change nonce', 8, 'change_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (31, 'Can delete nonce', 8, 'delete_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (32, 'Can view nonce', 8, 'view_nonce');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (33, 'Can add user social auth', 10, 'add_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (34, 'Can change user social auth', 10, 'change_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (35, 'Can delete user social auth', 10, 'delete_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (36, 'Can view user social auth', 10, 'view_usersocialauth');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (37, 'Can add partial', 9, 'add_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (38, 'Can change partial', 9, 'change_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (39, 'Can delete partial', 9, 'delete_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (40, 'Can view partial', 9, 'view_partial');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (41, 'Can add site', 11, 'add_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (42, 'Can change site', 11, 'change_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (43, 'Can delete site', 11, 'delete_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (44, 'Can view site', 11, 'view_site');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (45, 'Can add user', 12, 'add_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (46, 'Can change user', 12, 'change_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (47, 'Can delete user', 12, 'delete_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (48, 'Can view user', 12, 'view_customuser');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (49, 'Can add Banner', 13, 'add_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (50, 'Can change Banner', 13, 'change_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (51, 'Can delete Banner', 13, 'delete_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (52, 'Can view Banner', 13, 'view_banner');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (53, 'Can add Site Ayarı', 14, 'add_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (54, 'Can change Site Ayarı', 14, 'change_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (55, 'Can delete Site Ayarı', 14, 'delete_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (56, 'Can view Site Ayarı', 14, 'view_setting');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (57, 'Can add Post Tagı', 19, 'add_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (58, 'Can change Post Tagı', 19, 'change_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (59, 'Can delete Post Tagı', 19, 'delete_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (60, 'Can view Post Tagı', 19, 'view_tags');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (61, 'Can add Post Kategori', 15, 'add_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (62, 'Can change Post Kategori', 15, 'change_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (63, 'Can delete Post Kategori', 15, 'delete_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (64, 'Can view Post Kategori', 15, 'view_category');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (65, 'Can add Post', 18, 'add_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (66, 'Can change Post', 18, 'change_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (67, 'Can delete Post', 18, 'delete_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (68, 'Can view Post', 18, 'view_post');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (69, 'Can add Kategori Ziyareti', 16, 'add_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (70, 'Can change Kategori Ziyareti', 16, 'change_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (71, 'Can delete Kategori Ziyareti', 16, 'delete_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (72, 'Can view Kategori Ziyareti', 16, 'view_categoryview');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (73, 'Can add Post Yorum', 17, 'add_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (74, 'Can change Post Yorum', 17, 'change_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (75, 'Can delete Post Yorum', 17, 'delete_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (76, 'Can view Post Yorum', 17, 'view_comment');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (77, 'Can add Veritabanı Yedeği', 20, 'add_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (78, 'Can change Veritabanı Yedeği', 20, 'change_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (79, 'Can delete Veritabanı Yedeği', 20, 'delete_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (80, 'Can view Veritabanı Yedeği', 20, 'view_databasebackup');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (81, 'Can add crontab', 21, 'add_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (82, 'Can change crontab', 21, 'change_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (83, 'Can delete crontab', 21, 'delete_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (84, 'Can view crontab', 21, 'view_crontabschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (85, 'Can add interval', 22, 'add_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (86, 'Can change interval', 22, 'change_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (87, 'Can delete interval', 22, 'delete_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (88, 'Can view interval', 22, 'view_intervalschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (89, 'Can add periodic task', 23, 'add_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (90, 'Can change periodic task', 23, 'change_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (91, 'Can delete periodic task', 23, 'delete_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (92, 'Can view periodic task', 23, 'view_periodictask');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (93, 'Can add periodic task track', 24, 'add_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (94, 'Can change periodic task track', 24, 'change_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (95, 'Can delete periodic task track', 24, 'delete_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (96, 'Can view periodic task track', 24, 'view_periodictasks');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (97, 'Can add solar event', 25, 'add_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (98, 'Can change solar event', 25, 'change_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (99, 'Can delete solar event', 25, 'delete_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (100, 'Can view solar event', 25, 'view_solarschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (101, 'Can add clocked', 26, 'add_clockedschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (102, 'Can change clocked', 26, 'change_clockedschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (103, 'Can delete clocked', 26, 'delete_clockedschedule');
INSERT INTO "auth_permission" ("id", "name", "content_type_id", "codename") VALUES (104, 'Can view clocked', 26, 'view_clockedschedule');
-- Table: backup_databasebackup
DROP TABLE IF EXISTS "backup_databasebackup" CASCADE;
CREATE TABLE "backup_databasebackup" (
"id" BIGINT NOT NULL,
"name" VARCHAR(255) NOT NULL,
"file_path" VARCHAR(500),
"file_size" BIGINT,
"status" VARCHAR(20) NOT NULL,
"backup_type" VARCHAR(20) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"completed_at" TIMESTAMP WITH TIME ZONE,
"error_message" TEXT,
"notes" TEXT,
"created_by_id" BIGINT
);
-- Data for table: backup_databasebackup
INSERT INTO "backup_databasebackup" ("id", "name", "file_path", "file_size", "status", "backup_type", "created_at", "completed_at", "error_message", "notes", "created_by_id") VALUES (28, 'Manuel Yedek - 2025-12-24 17:57:02', NULL, NULL, 'in_progress', 'manual', '2025-12-24T17:57:02.880561+00:00'::timestamptz, NULL, NULL, NULL, 1);
-- Table: banners
DROP TABLE IF EXISTS "banners" CASCADE;
CREATE TABLE "banners" (
"id" BIGINT NOT NULL,
"color" VARCHAR(25) NOT NULL,
"title" VARCHAR(254),
"text1" VARCHAR(254),
"text2" VARCHAR(254),
"text4" VARCHAR(254),
"text5" VARCHAR(254),
"image" VARCHAR(100) NOT NULL,
"image_k" VARCHAR(100),
"image_k_txt" VARCHAR(254),
"is_active" BOOLEAN NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: categories
DROP TABLE IF EXISTS "categories" CASCADE;
CREATE TABLE "categories" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"keywords" VARCHAR(254) NOT NULL,
"description" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"order" INTEGER NOT NULL,
"slug" VARCHAR(250) NOT NULL,
"image" VARCHAR(100),
"parent_id" BIGINT
);
-- Table: category_views
DROP TABLE IF EXISTS "category_views" CASCADE;
CREATE TABLE "category_views" (
"id" BIGINT NOT NULL,
"ip_address" INET NOT NULL,
"user_agent" TEXT,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: comments
DROP TABLE IF EXISTS "comments" CASCADE;
CREATE TABLE "comments" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"body" TEXT NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"slug" VARCHAR(50) NOT NULL,
"parent_id" BIGINT,
"user_id" BIGINT NOT NULL,
"product_id" BIGINT NOT NULL
);
-- Table: django_admin_log
DROP TABLE IF EXISTS "django_admin_log" CASCADE;
CREATE TABLE "django_admin_log" (
"id" INTEGER NOT NULL,
"action_time" TIMESTAMP WITH TIME ZONE NOT NULL,
"object_id" TEXT,
"object_repr" VARCHAR(200) NOT NULL,
"action_flag" SMALLINT NOT NULL,
"change_message" TEXT NOT NULL,
"content_type_id" INTEGER,
"user_id" BIGINT NOT NULL
);
-- Data for table: django_admin_log
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (1, '2025-12-22T17:00:54.961166+00:00'::timestamptz, '1', 'Yedek 1 - Bekliyor', 1, '[{"added": {}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (2, '2025-12-22T17:01:10.019183+00:00'::timestamptz, '1', 'Yedek 1 - Bekliyor', 2, '[]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (3, '2025-12-22T17:08:18.352881+00:00'::timestamptz, '2', 'Manuel Yedek - 2025-12-22 17:01:15 - Başarısız', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (4, '2025-12-22T17:08:25.284922+00:00'::timestamptz, '4', 'Manuel Yedek - 2025-12-22 17:05:18 - Başarısız', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (5, '2025-12-22T17:08:30.992298+00:00'::timestamptz, '3', 'Manuel Yedek - 2025-12-22 17:03:41 - Başarısız', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (6, '2025-12-22T17:08:56.836202+00:00'::timestamptz, '5', 'Manuel Yedek - 2025-12-22 17:06:15 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (7, '2025-12-22T17:32:09.624013+00:00'::timestamptz, '7', 'Manuel Yedek - 2025-12-22 17:30:14 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (8, '2025-12-22T17:32:15.437591+00:00'::timestamptz, '6', 'Manuel Yedek - 2025-12-22 17:09:20 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (9, '2025-12-22T17:35:52.413394+00:00'::timestamptz, '8', 'Manuel Yedek - 2025-12-22 17:32:27 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (10, '2025-12-22T18:03:49.897584+00:00'::timestamptz, '13', 'Manuel Yedek - 2025-12-22 17:50:15 - Tamamlandı', 2, '[{"changed": {"fields": ["Yedek Tipi"]}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (11, '2025-12-22T18:08:37.961862+00:00'::timestamptz, '11', 'Manuel Yedek - 2025-12-22 17:38:03 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (12, '2025-12-22T18:08:57.986969+00:00'::timestamptz, '14', 'Manuel Yedek - 2025-12-22 18:07:38 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (13, '2025-12-22T18:09:03.531449+00:00'::timestamptz, '12', 'Manuel Yedek - 2025-12-22 17:43:28 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (14, '2025-12-22T18:09:17.538540+00:00'::timestamptz, '13', 'Manuel Yedek - 2025-12-22 17:50:15 - Tamamlandı', 2, '[{"changed": {"fields": ["Yedek Tipi"]}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (15, '2025-12-22T18:34:40.618018+00:00'::timestamptz, '16', 'Manuel Yedek - 2025-12-22 18:33:20 - Bekliyor', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (16, '2025-12-23T17:01:26.647467+00:00'::timestamptz, '18', 'Manuel Yedek - 2025-12-23 17:00:47 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (17, '2025-12-23T17:01:38.828269+00:00'::timestamptz, '17', 'Manuel Yedek - 2025-12-22 18:34:13 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (18, '2025-12-23T17:01:43.823658+00:00'::timestamptz, '15', 'Manuel Yedek - 2025-12-22 18:09:22 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (19, '2025-12-23T17:01:54.835538+00:00'::timestamptz, '13', 'Manuel Yedek - 2025-12-22 17:50:15 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (20, '2025-12-23T17:02:16.355915+00:00'::timestamptz, '19', 'Yedek Al - Bekliyor', 1, '[{"added": {}}]', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (21, '2025-12-24T15:12:30.215650+00:00'::timestamptz, '20', 'Manuel Yedek - 2025-12-23 17:02:44 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (22, '2025-12-24T15:13:08.133128+00:00'::timestamptz, '21', 'Manuel Yedek - 2025-12-24 15:12:38 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (23, '2025-12-24T15:14:20.197452+00:00'::timestamptz, '22', 'Manuel Yedek - 2025-12-24 15:13:32 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (24, '2025-12-24T15:21:35.234189+00:00'::timestamptz, '23', 'Manuel Yedek - 2025-12-24 15:21:11 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (25, '2025-12-24T15:25:09.589932+00:00'::timestamptz, '19', 'Yedek Al - Bekliyor', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (26, '2025-12-24T17:56:51.486638+00:00'::timestamptz, '27', 'Yüklenen Yedek - backup_server_dj_20251224_152152_test - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (27, '2025-12-24T17:56:51.486802+00:00'::timestamptz, '26', 'Manuel Yedek - 2025-12-24 15:28:28 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (28, '2025-12-24T17:56:51.486909+00:00'::timestamptz, '25', 'Manuel Yedek - 2025-12-24 15:26:24 - Tamamlandı', 3, '', 20, 1);
INSERT INTO "django_admin_log" ("id", "action_time", "object_id", "object_repr", "action_flag", "change_message", "content_type_id", "user_id") VALUES (29, '2025-12-24T17:56:51.487012+00:00'::timestamptz, '24', 'Manuel Yedek - 2025-12-24 15:21:52 - Tamamlandı', 3, '', 20, 1);
-- Table: django_celery_beat_clockedschedule
DROP TABLE IF EXISTS "django_celery_beat_clockedschedule" CASCADE;
CREATE TABLE "django_celery_beat_clockedschedule" (
"id" INTEGER NOT NULL,
"clocked_time" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: django_celery_beat_crontabschedule
DROP TABLE IF EXISTS "django_celery_beat_crontabschedule" CASCADE;
CREATE TABLE "django_celery_beat_crontabschedule" (
"id" INTEGER NOT NULL,
"minute" VARCHAR(240) NOT NULL,
"hour" VARCHAR(96) NOT NULL,
"day_of_week" VARCHAR(64) NOT NULL,
"day_of_month" VARCHAR(124) NOT NULL,
"month_of_year" VARCHAR(64) NOT NULL,
"timezone" VARCHAR(63) NOT NULL
);
-- Table: django_celery_beat_intervalschedule
DROP TABLE IF EXISTS "django_celery_beat_intervalschedule" CASCADE;
CREATE TABLE "django_celery_beat_intervalschedule" (
"id" INTEGER NOT NULL,
"every" INTEGER NOT NULL,
"period" VARCHAR(24) NOT NULL
);
-- Table: django_celery_beat_periodictask
DROP TABLE IF EXISTS "django_celery_beat_periodictask" CASCADE;
CREATE TABLE "django_celery_beat_periodictask" (
"id" INTEGER NOT NULL,
"name" VARCHAR(200) NOT NULL,
"task" VARCHAR(200) NOT NULL,
"args" TEXT NOT NULL,
"kwargs" TEXT NOT NULL,
"queue" VARCHAR(200),
"exchange" VARCHAR(200),
"routing_key" VARCHAR(200),
"expires" TIMESTAMP WITH TIME ZONE,
"enabled" BOOLEAN NOT NULL,
"last_run_at" TIMESTAMP WITH TIME ZONE,
"total_run_count" INTEGER NOT NULL,
"date_changed" TIMESTAMP WITH TIME ZONE NOT NULL,
"description" TEXT NOT NULL,
"crontab_id" INTEGER,
"interval_id" INTEGER,
"solar_id" INTEGER,
"one_off" BOOLEAN NOT NULL,
"start_time" TIMESTAMP WITH TIME ZONE,
"priority" INTEGER,
"headers" TEXT NOT NULL,
"clocked_id" INTEGER,
"expire_seconds" INTEGER
);
-- Table: django_celery_beat_periodictasks
DROP TABLE IF EXISTS "django_celery_beat_periodictasks" CASCADE;
CREATE TABLE "django_celery_beat_periodictasks" (
"ident" SMALLINT NOT NULL,
"last_update" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: django_celery_beat_solarschedule
DROP TABLE IF EXISTS "django_celery_beat_solarschedule" CASCADE;
CREATE TABLE "django_celery_beat_solarschedule" (
"id" INTEGER NOT NULL,
"event" VARCHAR(24) NOT NULL,
"latitude" NUMERIC NOT NULL,
"longitude" NUMERIC NOT NULL
);
-- Table: django_content_type
DROP TABLE IF EXISTS "django_content_type" CASCADE;
CREATE TABLE "django_content_type" (
"id" INTEGER NOT NULL,
"app_label" VARCHAR(100) NOT NULL,
"model" VARCHAR(100) NOT NULL
);
-- Data for table: django_content_type
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (1, 'admin', 'logentry');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (2, 'auth', 'group');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (3, 'auth', 'permission');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (4, 'contenttypes', 'contenttype');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (5, 'sessions', 'session');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (6, 'social_django', 'association');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (7, 'social_django', 'code');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (8, 'social_django', 'nonce');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (9, 'social_django', 'partial');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (10, 'social_django', 'usersocialauth');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (11, 'sites', 'site');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (12, 'accounts', 'customuser');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (13, 'settings', 'banner');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (14, 'settings', 'setting');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (15, 'blog', 'category');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (16, 'blog', 'categoryview');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (17, 'blog', 'comment');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (18, 'blog', 'post');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (19, 'blog', 'tags');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (20, 'backup', 'databasebackup');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (21, 'django_celery_beat', 'crontabschedule');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (22, 'django_celery_beat', 'intervalschedule');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (23, 'django_celery_beat', 'periodictask');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (24, 'django_celery_beat', 'periodictasks');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (25, 'django_celery_beat', 'solarschedule');
INSERT INTO "django_content_type" ("id", "app_label", "model") VALUES (26, 'django_celery_beat', 'clockedschedule');
-- Table: django_migrations
DROP TABLE IF EXISTS "django_migrations" CASCADE;
CREATE TABLE "django_migrations" (
"id" BIGINT NOT NULL,
"app" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NOT NULL,
"applied" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_migrations
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (1, 'contenttypes', '0001_initial', '2025-12-22T16:57:19.217932+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (2, 'contenttypes', '0002_remove_content_type_name', '2025-12-22T16:57:19.234555+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (3, 'auth', '0001_initial', '2025-12-22T16:57:19.434147+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (4, 'auth', '0002_alter_permission_name_max_length', '2025-12-22T16:57:19.446206+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (5, 'auth', '0003_alter_user_email_max_length', '2025-12-22T16:57:19.455809+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (6, 'auth', '0004_alter_user_username_opts', '2025-12-22T16:57:19.465593+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (7, 'auth', '0005_alter_user_last_login_null', '2025-12-22T16:57:19.475691+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (8, 'auth', '0006_require_contenttypes_0002', '2025-12-22T16:57:19.481434+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (9, 'auth', '0007_alter_validators_add_error_messages', '2025-12-22T16:57:19.565856+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (10, 'auth', '0008_alter_user_username_max_length', '2025-12-22T16:57:19.592172+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (11, 'auth', '0009_alter_user_last_name_max_length', '2025-12-22T16:57:19.603096+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (12, 'auth', '0010_alter_group_name_max_length', '2025-12-22T16:57:19.625591+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (13, 'auth', '0011_update_proxy_permissions', '2025-12-22T16:57:19.634914+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (14, 'auth', '0012_alter_user_first_name_max_length', '2025-12-22T16:57:19.645268+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (15, 'accounts', '0001_initial', '2025-12-22T16:57:19.898703+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (16, 'admin', '0001_initial', '2025-12-22T16:57:19.967758+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (17, 'admin', '0002_logentry_remove_auto_add', '2025-12-22T16:57:19.980668+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (18, 'admin', '0003_logentry_add_action_flag_choices', '2025-12-22T16:57:19.994932+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (19, 'backup', '0001_initial', '2025-12-22T16:57:20.047172+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (20, 'blog', '0001_initial', '2025-12-22T16:57:20.451373+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (21, 'sessions', '0001_initial', '2025-12-22T16:57:20.596961+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (22, 'settings', '0001_initial', '2025-12-22T16:57:20.623314+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (23, 'sites', '0001_initial', '2025-12-22T16:57:20.634939+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (24, 'sites', '0002_alter_domain_unique', '2025-12-22T16:57:20.648215+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (25, 'default', '0001_initial', '2025-12-22T16:57:20.743912+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (26, 'social_auth', '0001_initial', '2025-12-22T16:57:20.747238+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (27, 'social_django', '0001_initial', '2025-12-22T16:57:20.750337+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (28, 'default', '0002_add_related_name', '2025-12-22T16:57:20.772416+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (29, 'social_auth', '0002_add_related_name', '2025-12-22T16:57:20.776564+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (30, 'social_django', '0002_add_related_name', '2025-12-22T16:57:20.778681+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (31, 'default', '0003_alter_email_max_length', '2025-12-22T16:57:20.797950+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (32, 'social_auth', '0003_alter_email_max_length', '2025-12-22T16:57:20.800526+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (33, 'social_django', '0003_alter_email_max_length', '2025-12-22T16:57:20.802697+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (34, 'default', '0004_auto_20160423_0400', '2025-12-22T16:57:20.818189+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (35, 'social_auth', '0004_auto_20160423_0400', '2025-12-22T16:57:20.821978+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (36, 'social_django', '0004_auto_20160423_0400', '2025-12-22T16:57:20.824686+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (37, 'social_auth', '0005_auto_20160727_2333', '2025-12-22T16:57:20.838781+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (38, 'social_django', '0005_auto_20160727_2333', '2025-12-22T16:57:20.842005+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (39, 'social_django', '0006_partial', '2025-12-22T16:57:20.882162+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (40, 'social_django', '0007_code_timestamp', '2025-12-22T16:57:21.016558+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (41, 'social_django', '0008_partial_timestamp', '2025-12-22T16:57:21.036847+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (42, 'social_django', '0009_auto_20191118_0520', '2025-12-22T16:57:21.078912+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (43, 'social_django', '0010_uid_db_index', '2025-12-22T16:57:21.103380+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (44, 'social_django', '0011_alter_id_fields', '2025-12-22T16:57:21.271476+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (45, 'social_django', '0012_usersocialauth_extra_data_new', '2025-12-22T16:57:21.315237+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (46, 'social_django', '0013_migrate_extra_data', '2025-12-22T16:57:21.359048+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (47, 'social_django', '0014_remove_usersocialauth_extra_data', '2025-12-22T16:57:21.387186+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (48, 'social_django', '0015_rename_extra_data_new_usersocialauth_extra_data', '2025-12-22T16:57:21.411254+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (49, 'social_django', '0016_alter_usersocialauth_extra_data', '2025-12-22T16:57:21.425493+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (50, 'social_django', '0017_usersocialauth_user_social_auth_uid_required', '2025-12-22T16:57:21.447520+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (51, 'django_celery_beat', '0001_initial', '2025-12-22T17:29:12.618773+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (52, 'django_celery_beat', '0002_auto_20161118_0346', '2025-12-22T17:29:12.644272+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (53, 'django_celery_beat', '0003_auto_20161209_0049', '2025-12-22T17:29:12.661945+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (54, 'django_celery_beat', '0004_auto_20170221_0000', '2025-12-22T17:29:12.669274+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (55, 'django_celery_beat', '0005_add_solarschedule_events_choices', '2025-12-22T17:29:12.678019+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (56, 'django_celery_beat', '0006_auto_20180322_0932', '2025-12-22T17:29:12.752211+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (57, 'django_celery_beat', '0007_auto_20180521_0826', '2025-12-22T17:29:12.793017+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (58, 'django_celery_beat', '0008_auto_20180914_1922', '2025-12-22T17:29:12.831420+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (59, 'django_celery_beat', '0006_auto_20180210_1226', '2025-12-22T17:29:12.856887+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (60, 'django_celery_beat', '0006_periodictask_priority', '2025-12-22T17:29:12.877901+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (61, 'django_celery_beat', '0009_periodictask_headers', '2025-12-22T17:29:12.902729+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (62, 'django_celery_beat', '0010_auto_20190429_0326', '2025-12-22T17:29:13.109071+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (63, 'django_celery_beat', '0011_auto_20190508_0153', '2025-12-22T17:29:13.153527+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (64, 'django_celery_beat', '0012_periodictask_expire_seconds', '2025-12-22T17:29:13.170247+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (65, 'django_celery_beat', '0013_auto_20200609_0727', '2025-12-22T17:29:13.182913+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (66, 'django_celery_beat', '0014_remove_clockedschedule_enabled', '2025-12-22T17:29:13.197676+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (67, 'django_celery_beat', '0015_edit_solarschedule_events_choices', '2025-12-22T17:29:13.207482+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (68, 'django_celery_beat', '0016_alter_crontabschedule_timezone', '2025-12-22T17:29:13.224397+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (69, 'django_celery_beat', '0017_alter_crontabschedule_month_of_year', '2025-12-22T17:29:13.238625+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (70, 'django_celery_beat', '0018_improve_crontab_helptext', '2025-12-22T17:29:13.252445+00:00'::timestamptz);
INSERT INTO "django_migrations" ("id", "app", "name", "applied") VALUES (71, 'django_celery_beat', '0019_alter_periodictasks_options', '2025-12-22T17:29:13.259425+00:00'::timestamptz);
-- Table: django_session
DROP TABLE IF EXISTS "django_session" CASCADE;
CREATE TABLE "django_session" (
"session_key" VARCHAR(40) NOT NULL,
"session_data" TEXT NOT NULL,
"expire_date" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Data for table: django_session
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('e7jyr13wedmqdkjukqb35t2pyylkbvwz', '.eJxVjEEOwiAQRe_C2hBgpKBL9z0DmWFGqRpISrsy3l2bdKHb_977L5VwXUpau8xpYnVWVh1-N8L8kLoBvmO9NZ1bXeaJ9KbonXY9NpbnZXf_Dgr28q0F0bKTEGNG70Uie8vgLbGBYxQbwBHlwQ0szoILOQsDwMmZeKVgvHp_APiKN_E:1vXjGo:c9NPOwqzmQXV6RsDHkclP-w4ogI8VDPbV0KQilsiW6Y', '2026-01-05T17:00:30.494599+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('thlq90xyxsfsbjaps7tlga1dnluq990o', '.eJxVjDsOwjAQBe_iGllr2PhDSZ8zWOtdBweQI8VJhbg7iZQC2pl5760irUuJa8tzHEVdlVGnX5aIn7nuQh5U75PmqS7zmPSe6MM23U-SX7ej_Tso1Mq2JnSIDJkGAugMIzln_AbBnhFckMA8UELxRB7RYLCA4tgG6QT4oj5f0K43Zw:1vY5kS:rh1Px0710ffBgpJaxxgDsDyvhjpMKdKLRmAxhKHJuqg', '2026-01-06T17:00:36.697289+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('xgwdpmw5guv7ygdfh5hn8s7njr1m8q54', '.eJxVjDsOwjAQBe_iGllr2PhDSZ8zWOtdBweQI8VJhbg7iZQC2pl5760irUuJa8tzHEVdlVGnX5aIn7nuQh5U75PmqS7zmPSe6MM23U-SX7ej_Tso1Mq2JnSIDJkGAugMIzln_AbBnhFckMA8UELxRB7RYLCA4tgG6QT4oj5f0K43Zw:1vYQXF:plw9RHnEzpCK5mUlnVbLTCLYkvx4NS29nPXM1OQT6yE', '2026-01-07T15:12:21.391215+00:00'::timestamptz);
INSERT INTO "django_session" ("session_key", "session_data", "expire_date") VALUES ('8f1g3xhmdt9xwwyvlo3ozn57680zvlot', '.eJxVjDsOwjAQBe_iGllr2PhDSZ8zWOtdBweQI8VJhbg7iZQC2pl5760irUuJa8tzHEVdlVGnX5aIn7nuQh5U75PmqS7zmPSe6MM23U-SX7ej_Tso1Mq2JnSIDJkGAugMIzln_AbBnhFckMA8UELxRB7RYLCA4tgG6QT4oj5f0K43Zw:1vYT6F:5kBYD8TaD8dIBBcU6UwIVZCYGUwgGCe4IjA1ruLwbrw', '2026-01-07T17:56:39.326481+00:00'::timestamptz);
-- Table: django_site
DROP TABLE IF EXISTS "django_site" CASCADE;
CREATE TABLE "django_site" (
"id" INTEGER NOT NULL,
"domain" VARCHAR(100) NOT NULL,
"name" VARCHAR(50) NOT NULL
);
-- Data for table: django_site
INSERT INTO "django_site" ("id", "domain", "name") VALUES (1, 'example.com', 'example.com');
-- Table: posts
DROP TABLE IF EXISTS "posts" CASCADE;
CREATE TABLE "posts" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"content" TEXT,
"keywords" VARCHAR(254) NOT NULL,
"image" VARCHAR(100),
"video" VARCHAR(254),
"slug" VARCHAR(250) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL,
"is_front" BOOLEAN NOT NULL,
"parent_id" BIGINT
);
-- Table: posts_categories
DROP TABLE IF EXISTS "posts_categories" CASCADE;
CREATE TABLE "posts_categories" (
"id" BIGINT NOT NULL,
"post_id" BIGINT NOT NULL,
"category_id" BIGINT NOT NULL
);
-- Table: posts_tags
DROP TABLE IF EXISTS "posts_tags" CASCADE;
CREATE TABLE "posts_tags" (
"id" BIGINT NOT NULL,
"post_id" BIGINT NOT NULL,
"tags_id" BIGINT NOT NULL
);
-- Table: settings
DROP TABLE IF EXISTS "settings" CASCADE;
CREATE TABLE "settings" (
"id" BIGINT NOT NULL,
"title" VARCHAR(254) NOT NULL,
"meta_title" VARCHAR(254) NOT NULL,
"meta_description" VARCHAR(254) NOT NULL,
"phone" VARCHAR(254) NOT NULL,
"url" VARCHAR(254),
"email" VARCHAR(254) NOT NULL,
"facebook" VARCHAR(254),
"x" VARCHAR(254),
"instagram" VARCHAR(254),
"whatsapp" VARCHAR(254),
"slogan" VARCHAR(254),
"w_logo" VARCHAR(100),
"b_logo" VARCHAR(100),
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Table: social_auth_association
DROP TABLE IF EXISTS "social_auth_association" CASCADE;
CREATE TABLE "social_auth_association" (
"id" BIGINT NOT NULL,
"server_url" VARCHAR(255) NOT NULL,
"handle" VARCHAR(255) NOT NULL,
"secret" VARCHAR(255) NOT NULL,
"issued" INTEGER NOT NULL,
"lifetime" INTEGER NOT NULL,
"assoc_type" VARCHAR(64) NOT NULL
);
-- Table: social_auth_code
DROP TABLE IF EXISTS "social_auth_code" CASCADE;
CREATE TABLE "social_auth_code" (
"id" BIGINT NOT NULL,
"email" VARCHAR(254) NOT NULL,
"code" VARCHAR(32) NOT NULL,
"verified" BOOLEAN NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL
);
-- Table: social_auth_nonce
DROP TABLE IF EXISTS "social_auth_nonce" CASCADE;
CREATE TABLE "social_auth_nonce" (
"id" BIGINT NOT NULL,
"server_url" VARCHAR(255) NOT NULL,
"timestamp" INTEGER NOT NULL,
"salt" VARCHAR(65) NOT NULL
);
-- Table: social_auth_partial
DROP TABLE IF EXISTS "social_auth_partial" CASCADE;
CREATE TABLE "social_auth_partial" (
"id" BIGINT NOT NULL,
"token" VARCHAR(32) NOT NULL,
"next_step" SMALLINT NOT NULL,
"backend" VARCHAR(32) NOT NULL,
"timestamp" TIMESTAMP WITH TIME ZONE NOT NULL,
"data" JSONB NOT NULL
);
-- Table: social_auth_usersocialauth
DROP TABLE IF EXISTS "social_auth_usersocialauth" CASCADE;
CREATE TABLE "social_auth_usersocialauth" (
"id" BIGINT NOT NULL,
"provider" VARCHAR(32) NOT NULL,
"uid" VARCHAR(255) NOT NULL,
"user_id" BIGINT NOT NULL,
"created" TIMESTAMP WITH TIME ZONE NOT NULL,
"modified" TIMESTAMP WITH TIME ZONE NOT NULL,
"extra_data" JSONB NOT NULL
);
-- Table: tags
DROP TABLE IF EXISTS "tags" CASCADE;
CREATE TABLE "tags" (
"id" BIGINT NOT NULL,
"tag" VARCHAR(254) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"updated_at" TIMESTAMP WITH TIME ZONE NOT NULL,
"is_active" BOOLEAN NOT NULL
);
-- Reset sequences
SELECT setval('django_migrations_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_migrations"));
SELECT setval('django_content_type_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_content_type"));
SELECT setval('auth_permission_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_permission"));
SELECT setval('auth_group_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group"));
SELECT setval('auth_group_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "auth_group_permissions"));
SELECT setval('accounts_customuser_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser"));
SELECT setval('accounts_customuser_groups_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_groups"));
SELECT setval('accounts_customuser_user_permissions_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "accounts_customuser_user_permissions"));
SELECT setval('django_admin_log_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_admin_log"));
SELECT setval('backup_databasebackup_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "backup_databasebackup"));
SELECT setval('tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "tags"));
SELECT setval('categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "categories"));
SELECT setval('posts_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts"));
SELECT setval('posts_categories_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_categories"));
SELECT setval('posts_tags_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "posts_tags"));
SELECT setval('category_views_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "category_views"));
SELECT setval('comments_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "comments"));
SELECT setval('banners_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "banners"));
SELECT setval('settings_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "settings"));
SELECT setval('django_site_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_site"));
SELECT setval('social_auth_association_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_association"));
SELECT setval('social_auth_code_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_code"));
SELECT setval('social_auth_nonce_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_nonce"));
SELECT setval('social_auth_usersocialauth_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_usersocialauth"));
SELECT setval('social_auth_partial_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "social_auth_partial"));
SELECT setval('django_celery_beat_crontabschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_crontabschedule"));
SELECT setval('django_celery_beat_intervalschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_intervalschedule"));
SELECT setval('django_celery_beat_periodictask_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_periodictask"));
SELECT setval('django_celery_beat_solarschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_solarschedule"));
SELECT setval('django_celery_beat_clockedschedule_id_seq', (SELECT COALESCE(MAX("id"), 1) FROM "django_celery_beat_clockedschedule"));

0
blog/__init__.py Normal file
View File

101
blog/admin.py Normal file
View File

@@ -0,0 +1,101 @@
from django.contrib import admin
from django.utils.safestring import mark_safe
from blog.models import Category, Tags, Post, Comment, CategoryView
# Register your models here.
class PostAdmin(admin.ModelAdmin):
list_display = ('title', 'post_resim', 'is_active', 'post_kategorileri', 'slug')
list_filter = ('is_active', 'categories')
search_fields = ('title', 'is_active', 'slug', 'content')
list_editable = ('is_active', 'slug',) # Removed 'price' as it is not a field
class Meta:
model = Post
def save_model(self, request, obj, form, change):
"""Admin'de kaydetme sırasında image'ı thumb'a da kopyala"""
# Model save metodu zaten bu işi yapıyor, buradaki koda gerek yok aslında
# ama form üzerinden gelen veriyi kontrol etmek için bırakılabilir.
# Ancak model save metodundaki mantık daha sağlam olduğu için burayı sadeleştiriyoruz.
super().save_model(request, obj, form, change)
def formatted_hit_count(self, obj):
return obj.current_hit_count if obj.current_hit_count > 0 else '-'
formatted_hit_count.admin_order_field = 'hit_count'
formatted_hit_count.short_description = 'Hits'
def post_tags(self, obj):
tags = '<ul>'
for tag in obj.tags.all():
tags += '<li>' + tag.tag + '</li>'
tags += '</ul>'
return mark_safe(tags)
def post_kategorileri(self, obj):
html = '<ul>'
for category in obj.categories.all():
html += '<li>' + category.title + '</li>'
html += '</ul>'
return mark_safe(html)
def post_resim(self, obj):
if obj.image:
# Uygulama adı 'blog' olduğu için URL yapısı /admin/blog/post/... olmalı
return mark_safe(
'<a href="/admin/blog/post/{}/change/"><img src="{}" width="50" height="50" style="object-fit: cover;" /></a>'.format(
obj.id, obj.image.url))
return mark_safe('Resim Yok')
post_resim.short_description = 'Kurs Resmi'
admin.site.register(Post, PostAdmin)
class CategoryAdmin(admin.ModelAdmin):
list_display = ('title', 'parent_category', 'is_active', 'created_at', 'order') # Removed 'view_count' and 'unique_view_count'
list_filter = ('title', 'is_active', 'created_at', 'parent')
search_fields = ('title', 'is_active', 'slug')
list_editable = ('is_active', 'order')
class Meta:
model = Category
def parent_category(self, obj):
if obj.parent:
return obj.parent.title
return "Ana Kategori"
parent_category.short_description = 'Üst Kategori'
admin.site.register(Category, CategoryAdmin)
class TagsAdmin(admin.ModelAdmin):
list_display = ('tag', 'created_at',)
list_filter = ('tag',)
search_fields = ('tag',)
class Meta:
model = Tags
admin.site.register(Tags, TagsAdmin)
class CategoryViewAdmin(admin.ModelAdmin):
list_display = ('category', 'ip_address', 'created_at')
list_filter = ('created_at', 'category')
search_fields = ('ip_address', 'category__title')
readonly_fields = ('category', 'ip_address', 'user_agent', 'created_at')
class Meta:
model = CategoryView
admin.site.register(CategoryView, CategoryViewAdmin)
admin.site.register(Comment)

9
blog/apps.py Normal file
View File

@@ -0,0 +1,9 @@
from django.apps import AppConfig
class BlogConfig(AppConfig):
name = 'blog'
default_auto_field = 'django.db.models.BigAutoField'
def ready(self):
import blog.signals

View File

View File

View File

@@ -0,0 +1,85 @@
import os
import random
import string
import requests
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.core.files.base import ContentFile
from blog.models import Post, Category, Tags
try:
from faker import Faker
fake = Faker()
HAS_FAKER = True
except ImportError:
HAS_FAKER = False
class Command(BaseCommand):
help = 'Creates 300 fake posts with random images'
def handle(self, *args, **kwargs):
User = get_user_model()
# Prefer an existing staff user, otherwise any existing user, otherwise create a fallback user
user = User.objects.filter(is_staff=True).first() or User.objects.first()
if not user:
self.stdout.write('Hiç kullanıcı bulunamadı, `fakeuser` oluşturuluyor...')
user = User.objects.create(username='fakeuser', email='fake@example.com')
user.set_unusable_password()
user.save()
categories = list(Category.objects.all())
if not categories:
self.stdout.write(self.style.ERROR('Lütfen önce en az bir kategori oluşturun!'))
return
tags = list(Tags.objects.all())
if not tags:
self.stdout.write('Tag bulunamadı, oluşturuluyor...')
for i in range(5):
tag_name = self.get_random_string(8) if not HAS_FAKER else fake.word()
Tags.objects.create(tag=tag_name)
tags = list(Tags.objects.all())
self.stdout.write('300 adet fake post oluşturuluyor...')
for i in range(300):
if HAS_FAKER:
title = fake.sentence(nb_words=6).replace('.', '')
content = '\n\n'.join(fake.paragraphs(nb=5))
keywords = ", ".join(fake.words(nb=5))
else:
title = self.get_random_string(30)
content = self.get_random_string(500)
keywords = self.get_random_string(20)
post = Post(
user=user,
title=title,
content=content,
keywords=keywords,
video='none',
is_active=True,
is_front=True
)
post.save()
# ManyToMany ilişkileri
post.categories.add(random.choice(categories))
post.tags.add(random.choice(tags))
# Resim ekle
try:
# Picsum'dan rastgele resim (800x600)
img_url = f"https://picsum.photos/seed/{random.randint(1, 10000)}/800/600"
response = requests.get(img_url, timeout=10)
if response.status_code == 200:
file_name = f"fake_post_{i}_{random.randint(1000,9999)}.jpg"
post.image.save(file_name, ContentFile(response.content), save=True)
self.stdout.write(f'Post {i+1}/300 oluşturuldu: {title} (Resimli)')
else:
self.stdout.write(f'Post {i+1}/300 oluşturuldu: {title} (Resimsiz - İndirme hatası)')
except Exception as e:
self.stdout.write(f'Post {i+1}/300 oluşturuldu: {title} (Resimsiz - Hata: {str(e)})')
def get_random_string(self, length):
letters = string.ascii_letters + string.digits + ' '
return ''.join(random.choice(letters) for i in range(length))

View File

@@ -0,0 +1,127 @@
# Generated by Django 5.2.9 on 2026-01-05 22:33
import autoslug.fields
import core.utils
import django.db.models.deletion
import imagekit.models.fields
import tinymce.models
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Tags',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tag', models.CharField(max_length=254, verbose_name='Post Tagları')),
('slug', autoslug.fields.AutoSlugField(blank=True, editable=True, max_length=250, populate_from='tag', unique=True)),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Oluşturulma Tarihi')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Güncelleme Tarihi')),
('is_active', models.BooleanField(choices=[(True, 'Evet'), (False, 'Hayır')], default=True, verbose_name='Yayındamı')),
],
options={
'verbose_name': 'Post Tagı',
'verbose_name_plural': 'Post Tagları',
'db_table': 'tags',
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='Category',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=254, verbose_name='Kategori')),
('keywords', models.CharField(max_length=254, verbose_name='Seo Kelimeleri Aralarına Virgül Koyunuz')),
('description', models.CharField(max_length=254, verbose_name='ıklama')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Oluşturulma Tarihi')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Güncelleme Tarihi')),
('is_active', models.BooleanField(choices=[(True, 'Evet'), (False, 'Hayır')], default=True, verbose_name='Yayındamı')),
('order', models.IntegerField(db_index=True, default=1, verbose_name='Görüntülenme Sırası')),
('slug', autoslug.fields.AutoSlugField(blank=True, editable=True, max_length=250, populate_from='title', unique=True)),
('image', imagekit.models.fields.ProcessedImageField(blank=True, null=True, upload_to=core.utils.UniquePathAndRename('uploads/category'), verbose_name='Resim 630 x 653 Olmali ve Transparan PNG Olmali')),
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='child', to='blog.category', verbose_name='Üst Kategorisi')),
],
options={
'verbose_name': 'Post Kategori',
'verbose_name_plural': 'Post Kategorilerileri',
'db_table': 'categories',
'ordering': ['order'],
'unique_together': {('slug', 'parent')},
},
),
migrations.CreateModel(
name='Post',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=254, verbose_name='Post Başlığı')),
('content', tinymce.models.HTMLField(blank=True, null=True, verbose_name='Post İçeriği')),
('keywords', models.CharField(max_length=254, verbose_name='Seo Kelimeleri Aralarına Virgül Koyunuz')),
('image', imagekit.models.fields.ProcessedImageField(blank=True, null=True, upload_to=core.utils.UniquePathAndRename('uploads/post'))),
('thumb', imagekit.models.fields.ProcessedImageField(blank=True, editable=False, null=True, upload_to=core.utils.UniquePathAndRename('uploads/post/thumb'))),
('video', models.CharField(blank=True, default='none', max_length=254, null=True, verbose_name='Video')),
('slug', autoslug.fields.AutoSlugField(blank=True, editable=True, max_length=250, populate_from='title', unique=True)),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Oluşturulma Tarihi')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Güncelleme Tarihi')),
('is_active', models.BooleanField(choices=[(True, 'Evet'), (False, 'Hayır')], default=True, verbose_name='Yayındamı ?')),
('is_front', models.BooleanField(choices=[(True, 'Evet'), (False, 'Hayır')], default=True, verbose_name='Önde Görünsünmü ?')),
('categories', models.ManyToManyField(related_name='c_categories', to='blog.category', verbose_name='Post Kategorisi')),
('parent', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='child', to='blog.post', verbose_name='Konular')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='posts', to=settings.AUTH_USER_MODEL)),
('tags', models.ManyToManyField(related_name='tags', to='blog.tags', verbose_name='Post Tagları')),
],
options={
'verbose_name': 'Post',
'verbose_name_plural': 'Posts',
'db_table': 'posts',
'ordering': ['created_at'],
'unique_together': {('slug',)},
},
),
migrations.CreateModel(
name='CategoryView',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ip_address', models.GenericIPAddressField(verbose_name='IP Adresi')),
('user_agent', models.TextField(blank=True, null=True, verbose_name='User Agent')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Ziyaret Tarihi')),
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='category_views', to='blog.category')),
],
options={
'verbose_name': 'Kategori Ziyareti',
'verbose_name_plural': 'Kategori Ziyaretleri',
'db_table': 'category_views',
'indexes': [models.Index(fields=['category', 'ip_address', 'created_at'], name='category_vi_categor_234334_idx')],
},
),
migrations.CreateModel(
name='Comment',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=254, verbose_name='Yorum Başlığı')),
('body', models.TextField(verbose_name='Yorum')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Oluşturulma Tarihi')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Güncelleme Tarihi')),
('is_active', models.BooleanField(choices=[(True, 'Evet'), (False, 'Hayır')], default=True, verbose_name='Yayındamı')),
('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='title', unique=True)),
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='child', to='blog.comment')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cuser', to=settings.AUTH_USER_MODEL)),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='_product', to='blog.post')),
],
options={
'verbose_name': 'Post Yorum',
'verbose_name_plural': 'Post Yorumları',
'db_table': 'comments',
'ordering': ['-created_at'],
'unique_together': {('slug', 'parent')},
},
),
]

View File

@@ -0,0 +1,24 @@
# Generated by Django 5.2.9 on 2026-01-09 03:42
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='comment',
name='product',
),
migrations.AddField(
model_name='comment',
name='post',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='_post', to='blog.post'),
preserve_default=False,
),
]

View File

240
blog/models.py Normal file
View File

@@ -0,0 +1,240 @@
import os
from autoslug import AutoSlugField
from django.conf import settings
from django.core.files.base import ContentFile
from django.db import models
from imagekit.models import ProcessedImageField
from tinymce.models import HTMLField
from core.utils import image_optimizer
# Create your models here.
class Category(models.Model):
aktif = (
(True, 'Evet'),
(False, 'Hayır'),
)
title = models.CharField(max_length=254, verbose_name="Kategori")
keywords = models.CharField(max_length=254, verbose_name="Seo Kelimeleri Aralarına Virgül Koyunuz")
description = models.CharField(max_length=254, verbose_name="ıklama")
created_at = models.DateTimeField(auto_now_add=True, editable=False, verbose_name="Oluşturulma Tarihi")
updated_at = models.DateTimeField(auto_now=True, editable=False, verbose_name="Güncelleme Tarihi")
is_active = models.BooleanField(default=True, verbose_name='Yayındamı', choices=aktif)
order = models.IntegerField(verbose_name='Görüntülenme Sırası', default=1, db_index=True)
slug = AutoSlugField(populate_from='title', null=False, unique=True, editable=True, db_index=True, max_length=250,
blank=True)
parent = models.ForeignKey('self', related_name='child', on_delete=models.CASCADE, blank=True, null=True,
verbose_name='Üst Kategorisi')
image = ProcessedImageField(**image_optimizer('uploads/category', 300, 300, 85, 'PNG'),
verbose_name='Resim 630 x 653 Olmali ve Transparan PNG Olmali', blank=True, null=True)
class Meta:
ordering = ["order"]
db_table = 'categories'
verbose_name_plural = "Post Kategorilerileri"
verbose_name = "Post Kategori"
unique_together = ('slug', 'parent',)
def get_slug(self):
slug = self.title.replace('ı', "i").replace('İ', 'i')
number = 1
while Category.objects.filter(slug=slug).exists():
slug = '{}-{}'.format(slug, number)
number += 1
return slug
def save(self, *args, **kwargs):
if not self.slug:
self.slug = self.get_slug()
super().save(*args, **kwargs)
def __str__(self):
full_path = [self.title]
k = self.parent
while k is not None:
full_path.append(k.title)
k = k.parent
return ' -> '.join(full_path[::-1])
class Tags(models.Model):
aktif = (
(True, 'Evet'),
(False, 'Hayır'),
)
tag = models.CharField(max_length=254, verbose_name="Post Tagları")
slug = AutoSlugField(populate_from='tag', null=False, unique=True, editable=True, db_index=True, max_length=250,
blank=True)
created_at = models.DateTimeField(auto_now_add=True, editable=False, verbose_name="Oluşturulma Tarihi")
updated_at = models.DateTimeField(auto_now=True, editable=False, verbose_name="Güncelleme Tarihi")
is_active = models.BooleanField(default=True, verbose_name='Yayındamı', choices=aktif)
class Meta:
ordering = ["-created_at"]
db_table = 'tags'
verbose_name_plural = "Post Tagları"
verbose_name = "Post Tagı"
def get_slug(self):
slug = self.tag.replace('ı', "i").replace('İ', 'i')
number = 1
while Tags.objects.filter(slug=slug).exists():
slug = '{}-{}'.format(slug, number)
number += 1
return slug
def save(self, *args, **kwargs):
if not self.slug:
self.slug = self.get_slug()
super().save(*args, **kwargs)
def __str__(self):
return self.tag
class Post(models.Model):
aktif = (
(True, 'Evet'),
(False, 'Hayır'),
)
title = models.CharField(max_length=254, verbose_name="Post Başlığı")
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='posts', null=True, blank=True)
content = HTMLField(blank=True, null=True, verbose_name='Post İçeriği')
categories = models.ManyToManyField(Category, verbose_name="Post Kategorisi", related_name='c_categories')
keywords = models.CharField(max_length=254, verbose_name="Seo Kelimeleri Aralarına Virgül Koyunuz")
tags = models.ManyToManyField(Tags, verbose_name="Post Tagları", related_name='tags')
image = ProcessedImageField(**image_optimizer('uploads/post', 840, 500, 85, 'avif'), null=True, blank=True)
thumb = ProcessedImageField(**image_optimizer('uploads/post/thumb', 348, 160, 85, 'avif'), null=True, blank=True,editable=False)
video = models.CharField(verbose_name="Video", null=True, blank=True, max_length=254, default='none')
slug = AutoSlugField(populate_from='title', null=False, unique=True, editable=True, db_index=True, max_length=250,
blank=True)
created_at = models.DateTimeField(auto_now_add=True, editable=False, verbose_name="Oluşturulma Tarihi")
updated_at = models.DateTimeField(auto_now=True, editable=False, verbose_name="Güncelleme Tarihi")
is_active = models.BooleanField(default=True, verbose_name='Yayındamı ?', choices=aktif)
is_front = models.BooleanField(default=True, verbose_name='Önde Görünsünmü ?', choices=aktif)
parent = models.ForeignKey('self', related_name='child', on_delete=models.CASCADE, blank=True, null=True,
editable=False,
verbose_name='Konular')
class Meta:
ordering = ["created_at"]
db_table = 'posts'
verbose_name_plural = "Posts"
verbose_name = "Post"
unique_together = ('slug',)
def get_slug(self):
slug = self.title.replace('ı', "i").replace('İ', 'i')
number = 1
while Post.objects.filter(slug=slug).exists():
slug = '{}-{}'.format(slug, number)
number += 1
return slug
def save(self, *args, **kwargs):
if not self.slug:
self.slug = self.get_slug()
if self.image:
# Eğer yeni bir kayıt ise veya resim değişmişse
update_thumb = False
if not self.pk:
update_thumb = True
else:
try:
old_instance = self.__class__.objects.get(pk=self.pk)
if self.image != old_instance.image:
update_thumb = True
except self.__class__.DoesNotExist:
pass
if update_thumb:
try:
if hasattr(self.image, 'closed') and self.image.closed:
self.image.open()
if hasattr(self.image, 'seek'):
self.image.seek(0)
content = self.image.read()
filename = os.path.basename(self.image.name)
# Doğrudan alana ata, super().save() işleyecek
self.thumb = ContentFile(content, name=filename)
except Exception:
pass
finally:
if hasattr(self.image, 'seek'):
self.image.seek(0)
super().save(*args, **kwargs)
def __str__(self):
return f"Postlar: {self.title}"
class CategoryView(models.Model):
"""Kategori ziyaretlerini takip etmek için model"""
category = models.ForeignKey(Category, on_delete=models.CASCADE, related_name='category_views')
ip_address = models.GenericIPAddressField(verbose_name='IP Adresi')
user_agent = models.TextField(blank=True, null=True, verbose_name='User Agent')
created_at = models.DateTimeField(auto_now_add=True, verbose_name='Ziyaret Tarihi')
class Meta:
db_table = 'category_views'
verbose_name = 'Kategori Ziyareti'
verbose_name_plural = 'Kategori Ziyaretleri'
# unique_together kısıtlamasını kaldırdık - artık günlük bazda kontrol edeceğiz
indexes = [
models.Index(fields=['category', 'ip_address', 'created_at']),
]
def __str__(self):
return f"{self.category.title} - {self.ip_address} - {self.created_at.strftime('%Y-%m-%d %H:%M')}"
class Comment(models.Model):
aktif = (
(True, 'Evet'),
(False, 'Hayır'),
)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='cuser')
product = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='_product')
title = models.CharField(max_length=254, verbose_name="Yorum Başlığı")
body = models.TextField(verbose_name='Yorum')
created_at = models.DateTimeField(auto_now_add=True, editable=False, verbose_name="Oluşturulma Tarihi")
updated_at = models.DateTimeField(auto_now=True, editable=False, verbose_name="Güncelleme Tarihi")
is_active = models.BooleanField(default=True, verbose_name='Yayındamı', choices=aktif)
slug = AutoSlugField(populate_from='title', null=False, unique=True, editable=False, db_index=True)
parent = models.ForeignKey('self', related_name='child', on_delete=models.CASCADE, blank=True, null=True)
class Meta:
ordering = ["-created_at"]
db_table = 'comments'
verbose_name_plural = "Post Yorumları"
verbose_name = "Post Yorum"
unique_together = ('slug', 'parent',)
def get_slug(self):
slug = self.title.replace('ı', "i").replace('İ', 'i')
number = 1
while Comment.objects.filter(slug=slug).exists():
slug = '{}-{}'.format(slug, number)
number += 1
return slug
def save(self, *args, **kwargs):
if not self.slug:
self.slug = self.get_slug()
super().save(*args, **kwargs)
def __str__(self):
full_path = [self.title]
k = self.parent
while k is not None:
full_path.append(k.title)
k = k.parent
return ' -> '.join(full_path[::-1])

89
blog/serializers.py Normal file
View File

@@ -0,0 +1,89 @@
from rest_framework import serializers
from blog.models import Category, Post, Tags
class CateSerializer(serializers.ModelSerializer):
parent = serializers.StringRelatedField() # ID yerine __str__ metodundaki değeri döndürür
class Meta:
model = Category
fields = ['title', 'parent', 'is_active', 'created_at', 'order', 'slug', 'image', 'keywords', 'description']
class TagSerializer(serializers.ModelSerializer):
class Meta:
model = Tags
fields = ['tag', 'slug']
class PostSerializer(serializers.ModelSerializer):
categories = CateSerializer(read_only=True, many=True)
# Tags için sadece tag ismini döndürmek daha temiz olabilir, ama mevcut yapıyı koruyalım
# Eğer sadece isim listesi istenirse: tags = serializers.SlugRelatedField(many=True, read_only=True, slug_field='tag')
tags = TagSerializer(read_only=True, many=True)
class Meta:
model = Post
fields = ['title', 'content', 'categories', 'keywords', 'tags', 'image', 'thumb', 'video',
'slug', 'created_at', 'updated_at', 'is_active', 'is_front']
# fields = '__all__'
class PostSYalinerializer(serializers.ModelSerializer):
class Meta:
model = Post
fields = ['slug', ]
# fields = '__all__'
class CategorySerializer(serializers.ModelSerializer):
posts = PostSYalinerializer(source='c_categories', read_only=True, many=True)
child = serializers.SerializerMethodField()
class Meta:
model = Category
fields = ['title', 'parent', 'is_active', 'created_at', 'order', 'slug', 'image', 'keywords', 'description',
'posts', 'child']
def get_child(self, obj):
serializer = self.__class__(obj.child.all(), many=True, context=self.context)
return serializer.data
class CategoryPostSerializer(serializers.ModelSerializer):
posts = serializers.SerializerMethodField()
child = serializers.SerializerMethodField()
class Meta:
model = Category
fields = ['title', 'parent', 'is_active', 'created_at', 'order', 'slug', 'image', 'keywords', 'description',
'posts', 'child']
def get_posts(self, obj):
# Pagination context'ini al
paginator = self.context.get('paginator')
request = self.context.get('request')
posts = obj.c_categories.all()
if paginator and request:
# Pagination uygula
paginated_posts = paginator.paginate_queryset(posts, request)
serializer = PostSerializer(paginated_posts, many=True, context=self.context)
return {
'results': serializer.data,
'count': posts.count(),
'next': paginator.get_next_link(),
'previous': paginator.get_previous_link(),
}
else:
# Pagination yoksa normal döndür
serializer = PostSerializer(posts, many=True, context=self.context)
return serializer.data
def get_child(self, obj):
serializer = self.__class__(obj.child.all(), many=True, context=self.context)
return serializer.data

52
blog/signals.py Normal file
View File

@@ -0,0 +1,52 @@
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.core.files.base import ContentFile
from .models import Post
@receiver(pre_save, sender=Post)
def update_post_thumb(sender, instance, **kwargs):
"""
Post kaydedilmeden önce, image alanı doluysa thumb'ı da güncelle
"""
if instance.image:
# Yeni kayıt veya image güncellenmiş mi kontrol et
should_update_thumb = False
if instance.pk:
try:
old_instance = Post.objects.get(pk=instance.pk)
# Image değişmişse thumb'ı da güncelle
if str(old_instance.image) != str(instance.image):
should_update_thumb = True
except Post.DoesNotExist:
# Kayıt bulunamadı, yeni kayıt gibi davran
should_update_thumb = True
else:
# Yeni kayıt (pk yok)
should_update_thumb = True
if should_update_thumb and hasattr(instance.image, 'file'):
# Image dosyasını thumb alanına kopyala
try:
# Image dosyasının içeriğini oku
instance.image.file.seek(0)
image_content = instance.image.file.read()
instance.image.file.seek(0)
# Dosya adını al
image_name = instance.image.name.split('/')[-1]
# Thumb alanına kaydet
instance.thumb.save(
image_name,
ContentFile(image_content),
save=False
)
except Exception as e:
print(f"Thumb oluşturma hatası: {e}")
import traceback
traceback.print_exc()

40
blog/tasks.py Normal file
View File

@@ -0,0 +1,40 @@
from celery import shared_task
from django.core.mail import send_mail
from django.conf import settings
@shared_task
def send_comment_notification_email(comment_title, comment_body, post_title, user_email):
"""
Yeni bir yorum yapıldığında admin'e e-posta gönderir.
"""
subject = f'Yeni Yorum: {post_title}'
message = f"""
Merhaba Admin,
"{post_title}" başlıklı yazıya yeni bir yorum yapıldı.
Yorum Yapan: {user_email}
Başlık: {comment_title}
Yorum: {comment_body}
Kontrol etmek için admin paneline giriş yapabilirsiniz.
"""
# Admin e-posta adresini settings'den veya doğrudan buraya yazabilirsiniz
# Örnek olarak settings.DEFAULT_FROM_EMAIL kullanıldı, admin listesi de kullanılabilir
admin_email = settings.DEFAULT_FROM_EMAIL
# Eğer settings.ADMINS tanımlıysa oradaki ilk kişiye de atılabilir
if hasattr(settings, 'ADMINS') and settings.ADMINS:
recipient_list = [email for name, email in settings.ADMINS]
else:
# Fallback olarak bir email
recipient_list = ['admin@example.com']
send_mail(
subject,
message,
settings.DEFAULT_FROM_EMAIL,
recipient_list,
fail_silently=False,
)

3
blog/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

10
blog/urls.py Normal file
View File

@@ -0,0 +1,10 @@
from django.urls import path
from blog.views import CategoryList, CategoryDetail, PostDetail, PostList
urlpatterns = [
path('categories/', CategoryList.as_view(), name='categories.list'),
path('categories/<slug:slug>/', CategoryDetail.as_view(), name='categories.details'),
path('post/', PostList.as_view(), name='post.list'),
path('post/<slug:slug>/', PostDetail.as_view(), name='post.details'),
]

47
blog/views.py Normal file
View File

@@ -0,0 +1,47 @@
from rest_framework.generics import ListAPIView, RetrieveAPIView
from rest_framework.pagination import PageNumberPagination
from blog.models import Post, Category
from blog.serializers import PostSerializer, CategorySerializer, CategoryPostSerializer
from core.Permission import ReadOnly
class StandardResultsSetPagination(PageNumberPagination):
page_size = 10
page_size_query_param = 'page_size'
max_page_size = 100
# Create your views here.
class CategoryList(ListAPIView):
permission_classes = [ReadOnly]
queryset = Category.objects.order_by('order').filter(is_active=True, parent__isnull=True).all()
# serializer_class = ParentSerializer
serializer_class = CategorySerializer
class CategoryDetail(RetrieveAPIView):
permission_classes = [ReadOnly]
queryset = Category.objects.order_by('order').filter(is_active=True).all()
serializer_class = CategoryPostSerializer
lookup_field = 'slug' # Slug ile arama yapılacak
def get_serializer_context(self):
context = super().get_serializer_context()
context['paginator'] = StandardResultsSetPagination()
return context
# Create your views here.
class PostList(ListAPIView):
permission_classes = [ReadOnly]
queryset = Post.objects.all()
serializer_class = PostSerializer
pagination_class = StandardResultsSetPagination
class PostDetail(RetrieveAPIView):
permission_classes = [ReadOnly]
queryset = Post.objects.all()
serializer_class = PostSerializer
lookup_field = 'slug' # Slug ile arama yapılacak

28
caddy/Caddyfile Normal file
View File

@@ -0,0 +1,28 @@
:80 {
# Büyük upload limiti (Nginx'teki client_max_body_size 100M eşdeğeri)
request_body {
max_size 100MB
}
# Static dosyalar
handle_path /static/* {
root * /app/staticfiles
header Cache-Control "public, immutable"
file_server
}
# Media dosyalar
handle_path /media/* {
root * /app/media
header Cache-Control "public"
file_server
}
# Diğer tüm istekler Django'ya
reverse_proxy django_web_prod:8000 {
header_up Host {host}
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
}
}

4
caddy/Dockerfile Normal file
View File

@@ -0,0 +1,4 @@
FROM caddy:2
# Build context repo root'u (.) olduğu için caddy/Caddyfile yolu kullanıyoruz
COPY caddy/Caddyfile /etc/caddy/Caddyfile

View File

@@ -0,0 +1 @@
{"web":{"client_id":"915364976256-691m0s87as2r5vdbqr96f6humblseobt.apps.googleusercontent.com","project_id":"django-471018","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["http://localhost:3000/api/auth/callback/google","http://localhost:8000/api/auth/callback/google","http://127.0.0.1:8000/api/auth/callback/google","http://127.0.0.1:3000/api/auth/callback/google","http://127.0.0.1:8000/accounts/auth/google/login/callback/","http://127.0.0.1:8000/auth/google/callback/","http://localhost:8000/auth/google/callback/","http://localhost:3000/auth/google","http://localhost:8000/auth/google"],"javascript_origins":["http://localhost:3000","http://localhost:8000","http://127.0.0.1:8000","http://127.0.0.1:3000"]}}

View File

@@ -0,0 +1,314 @@
# Copilot için Ayrıntılı Prompt: Django 6.0 Custom Account + Djoser + JWT + Social Auth
Aşağıdaki metni **Copilot Chat** veya GitHub Copilota vereceğim. Sen (Copilot) bu projede adım adım ilerleyen bir **backend mimarı + uygulayıcı** gibi davranacaksın.
## Proje Bağlamı
- Framework: **Django==6.0**
- API: **Django REST Framework (djangorestframework==3.16.1)**
- Auth:
- **Djoser==2.3.3**
- **djangorestframework_simplejwt==5.5.1**
- Ek olarak **social auth** social-auth-app-django==5.6.0 social-auth-core==4.8.1 bunlar kulanilacak
- Bu proje bir **REST backend** olacak ve **Nuxt.js** ile **Next.js** frontendlere servis verecek.
- SPA (Single Page App) + JWT kullanımına uygun olacak.
- CORS, JSON response formatı, JWT bearer token desteği önemli.(Corsheader Paketi yuklu ve yaplandirlmis)
## İstediğim Auth Sistemi (Özet)
1. **Custom User Model** (email tabanlı):
- Login **email ile** yapılacak (username yok).
- Register da email + password ile olacak.
- `AUTH_USER_MODEL` olarak özel bir user modeli (örn. `accounts.CustomUser`) kullanılacak.
- `USERNAME_FIELD = "email"`
- `email` unique olacak.
- Normal (email/password) register ile oluşturulan hesaplar:
- Başlangıçta `is_active = False` olacak.
- Kullanıcı eposta aktivasyonu yapmadan giriş yapamayacak.
- **Social login** ile gelen hesaplar:
- `is_active = True` olacak (yani sosyal hesaplar için ayrıca email aktivasyon istemeyeceğiz).
2. **Register Akışı (Email/Password)**:
- Örnek endpoint (Djoser varsayılanı da olabilir): `POST /auth/register/`
- Request body:
```json
{
"email": "user@example.com",
"password": "StrongP@ssw0rd",
"re_password": "StrongP@ssw0rd",
"first_name": "Ali",
"last_name": "Veli"
}
```
- İşleyiş:
- Yeni user oluşturulur, `is_active = False` atanır.
- Djoser üzerinden aktivasyon epostası gönderilir.
- Aktivasyon linki Djoserin `ACTIVATION_URL` formatına göre hazırlanır:
- Örn: `https://frontend-domain/auth/activate/{uid}/{token}/` (Nuxt/Next içindeki sayfaya yönlenebilir).
3. **Email Aktivasyon**:
- Endpoint (Djoser): `POST /auth/activate/`
- Request body:
```json
{
"uid": "<uid_from_email>",
"token": "<token_from_email>"
}
```
- Aktivasyon başarılı olursa:
- `user.is_active = True`
- Kullanıcı artık JWT ile login olabilecek.
4. **Login (JWT ile)**:
- JWT auth için `djangorestframework_simplejwt` kullanılacak.
- Djoserla entegre endpoint:
- `POST /auth/jwt/create/`
- Request body:
```json
{
"email": "user@example.com",
"password": "StrongP@ssw0rd"
}
```
- Response:
```json
{
"access": "<jwt_access_token>",
"refresh": "<jwt_refresh_token>"
}
```
- **Aktivasyon yapmamış** kullanıcı login olmaya çalışırsa:
- Uygun bir hata kodu (400/401) ve anlamlı bir hata mesajı dönecek:
- Örn: `"detail": "Account is not activated. Please check your email."`
5. **Social Login**:
- Özel social auth endpointleri istiyorum:
- Örnek: `POST /auth/social/<provider>/` (ör: `/auth/social/google/`, `/auth/social/github/`).
- Frontend (Nuxt/Next) tarafı:
- Genelde OAuth flowu client-side yapıp backende `access_token` gönderiyor.
- Backend tarafı:
- Providerdan gelen `access_token` ile kullanıcı bilgisi alınacak.
- Providerdan email alınamazsa, uygun bir hata dönülecek (misal: `"Email not provided by provider"`).
- Eğer email varsa:
- Kullanıcı bulunursa giriş yaptır, yoksa yeni bir kullanıcı oluştur.
- Bu kullanıcı için:
- `is_active = True` olarak set edilecek.
- **Ekstra email aktivasyon epostası gönderilmeyecek**.
- Ardından JWT access/refresh token üret ve response olarak dön:
```json
{
"access": "<jwt_access_token>",
"refresh": "<jwt_refresh_token>",
"user": {
"id": 1,
"email": "user@example.com",
"first_name": "Ali",
"last_name": "Veli"
}
}
```
6. **Djoser Yapılandırması**:
- `djoser==2.3.3` kullanılacak.
- `settings.py` içinde `DJOSER = { ... }` konfigürasyonu yapılacak.
- Örnek ayarlar:
- `SEND_ACTIVATION_EMAIL = True`
- `ACTIVATION_URL = "auth/activate/{uid}/{token}/"` (buraya Nuxt/Next üzerindeki routeu da koyabiliriz).
- `SERIALIZERS` içinde:
- `user_create` → custom serializer (register sırasında `is_active=False` ayarlayacak).
- `user` → custom user serializer (frontende gönderilecek user alanlarını kontrol etmek için).
- Token modeli kullanmayacaksak `TOKEN_MODEL = None` vs.
7. **JWT Ayarları (SIMPLE_JWT)**:
- `REST_FRAMEWORK` → `DEFAULT_AUTHENTICATION_CLASSES` içinde `rest_framework_simplejwt.authentication.JWTAuthentication` tanımlanacak.
- `SIMPLE_JWT` içinde access/refresh lifetime, `AUTH_HEADER_TYPES = ("Bearer",)` vb. ayarları yapacağız.
8. **Email Gönderimi**:
- Geliştirme ortamı:
- `EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"` olabilir.
- Prod ortamı:
- ENV üzerinden SMTP ayarları (`EMAIL_HOST`, `EMAIL_PORT`, `EMAIL_HOST_USER`, `EMAIL_HOST_PASSWORD`, `EMAIL_USE_TLS` vb.)
- Aktivasyon için HTML ve plain text templateleri:
- `templates/email/activation_email.html`
- `templates/email/activation_email.txt`
- sindilik localdeki emailpit kullanalim
9. **CORS / SPA Entegrasyonu**:
- Nuxt ve Next için:
- `CORS_ALLOWED_ORIGINS` içinde dev ve prod URLler olacak (örn. `http://localhost:3000`, `http://localhost:5173`, vs.).
- Auth:
- JWT bearer token kullanılacak: `Authorization: Bearer <access_token>`
- Cookie tabanlı session auth kullanmayacağız (veya minimal). CSRF, SPA senaryosuna göre ayarlanacak / devre dışı bırakılacak (bunu açıklayan bir not yaz).
10. **Güvenlik & Rate Limiting**:
- Django password validators aktif olacak.
- Auth endpointleri için basic throttling / rate limit ayarları öner ve uygula (ör: DRF throttling).
11. **Testler**:
- En azından aşağıdakiler için tests yaz:
- Register → user oluşturuluyor mu, `is_active=False` mi, email aktivasyonu tetikleniyor mu?
- Activate → doğru uid/token ile aktivasyon başarılı mı? Yanlış ise hata veriyor mu?
- Login → aktif kullanıcı login olabiliyor mu? Aktif olmayan için hata dönüyor mu?
- Social login → access_token üzerinden providerdan user elde ediliyor mu, `is_active=True` ile user oluşturuluyor mu, JWT dönüyor mu?
12. **Dokümantasyon**:
- Örnek bir doküman dosyası: `AUTH.md` veya `README.md` içinde bir bölüm:
- Tüm auth endpointleri
- Örnek request/responselar
- Nuxt/Next tarafında nasıl kullanılacağına dair ayrintili notlar
- ENV değişkenleri (email, social provider keys vs.)
## Dosya ve Kod Yapı Planı
Aşağıdakiler bir referans plan; proje yapısına göre isimler uyarlanabilir (örn. `config/settings.py` vs. `project/settings.py`).
- `accounts/models.py`
- `CustomUser(AbstractBaseUser, PermissionsMixin)`:
- Alanlar: `email`, `first_name`, `last_name`, `is_staff`, `is_active`, `date_joined` vb.
- `USERNAME_FIELD = "email"`
- `REQUIRED_FIELDS = []` (veya first_name/last_name)
- `CustomUserManager`:
- `create_user`
- `create_superuser`
- `accounts/admin.py`
- Django adminde custom userı `UserAdmin` türeterek kaydet.
- `accounts/serializers.py`
- `CustomUserCreateSerializer`:
- Register sırasında kullanılır.
- `is_active=False` set eder.
- `CustomUserSerializer`:
- Kullanıcı profilini döner (id, email, first_name, last_name vb.).
- `SocialLoginSerializer`:
- Alanlar: `provider`, `access_token` (ve gerekiyorsa `id_token` vs.).
- `accounts/views.py`
- Gerekirse:
- `SocialLoginView` (providera göre token doğrulayan, user oluşturan/döndüren, sonra JWT üreten).
- İsteğe bağlı: `ResendActivationView`.
- `accounts/urls.py`
- `/auth/social/<provider>/` için route.
- Djoser urlleri (register/activate/jwt vb.) de burada veya ana `urls.py` içinde include edilebilir.
- `config/settings.py` (veya proje settings dosyası)
- `INSTALLED_APPS`:
- `'accounts'`
- `'rest_framework'`
- `'djoser'`
- `'rest_framework_simplejwt'`
- `'corsheaders'`
- Social auth için: `'social_django'` veya seçtiğimiz paket.
- `AUTH_USER_MODEL = "accounts.CustomUser"`
- `REST_FRAMEWORK` ayarları (`DEFAULT_AUTHENTICATION_CLASSES`, throttling vb.)
- `SIMPLE_JWT` ayarları
- `DJOSER` konfigürasyonu
- `CORS_ALLOWED_ORIGINS`
- `EMAIL_BACKEND` ve diğer email ayarları
- Social provider ayarları (`SOCIAL_AUTH_*` veya ilgili konfigler)
- `templates/email/activation_email.html`
- `templates/email/activation_email.txt`
- `requirements.txt`
- `Django==6.0`
- `djangorestframework==3.16.1`
- `djoser==2.3.3`
- `djangorestframework_simplejwt==5.5.1`
- `social-auth-app-django` (veya tercih ettiğimiz social auth paketi)
- `django-cors-headers`
- `tests/test_accounts.py`
- Yukarıda bahsettiğim tüm kritik akışlar için testler.
## Hafıza / Progress Kaydı: COPILOT_MEMORY.md
Projede ne yapıldığını **hatırlamak** için özel bir dosya istiyorum:
- Repo kökünde: `COPILOT_MEMORY.md`
- Copilot, her önemli adım veya mantıklı grup değişiklikten sonra bu dosyaya **append** yapsın.
- Kayıt formatı şöyle olsun (örnek):
```markdown
## 2025-12-11T14:32:00Z
- Değişiklik özeti:
- CustomUser model ve manager eklendi.
- settings.py'de AUTH_USER_MODEL ve djoser/jwt ayarlarının temeli kuruldu.
- Dosyalar:
- accounts/models.py
- accounts/admin.py
- config/settings.py
- Next steps:
- Custom registration serializer ve activation email şablonlarını ekle.
```
Kurallar:
- Her anlamlı değişiklik setinden sonra yeni bir `## <ISO 8601 timestamp>` başlığı ile blok ekle.
- Bir sonraki yapılacakları (Next steps) kısa ve net yaz.
- Eğer PR açıyorsan, ilgili PR açıklamasına bu kaydın kısa özetini de ekle.
## Geliştirme Adımları (Önerilen Sıra)
Copilottan beklediğim ilerleme sırası:
1. **Custom User Model**
- `accounts` app oluştur (yoksa).
- `CustomUser` ve `CustomUserManager` yaz.
- `AUTH_USER_MODEL` ayarla.
- Migrasyonları oluştur ve çalıştırılabilir hale getir (kod olarak migration dosyaları üret).
2. **Temel Settings Konfigürasyonu**
- `INSTALLED_APPS`, `REST_FRAMEWORK`, `SIMPLE_JWT`, `DJOSER`, `CORS`, `EMAIL_BACKEND` vs. temel ayarlar.
- Nuxt/Next için örnek CORS domainleri koy (yorum satırı olarak da olabilir).
3. **Djoser Register / Activate / JWT**
- Djoserın default endpointlerini aktif et.
- `CustomUserCreateSerializer`ı bağla, register sırasında `is_active=False` olsun.
- Aktivasyon URLini Nuxt/Next kullanacak şekilde düzenle.
4. **Social Auth Entegrasyonu**
- Seçilecek social auth paketini netleştir (preferans: `social-auth-app-django`).
- Provider konfigleri için env örnekleri yaz.
- `SocialLoginView` ve `SocialLoginSerializer` ile:
- Provider token doğrulama
- Email ile user bul/oluştur
- `is_active=True` set et
- JWT üret ve dön.
5. **Email Şablonları**
- Aktivasyon e-postası için HTML ve text templateleri yaz.
6. **Testler**
- Temel testler: register, activate, login, social login.
7. **Dokümantasyon**
- `AUTH.md` veya READMEye auth bölümünü ekle.
8. **COPILOT_MEMORY.md Güncellemeleri**
- Her adımda bu dosyaya not düş.
## Copilota Komutum
Bu promptu aldıktan sonra, lütfen:
1. Projeyi ve hedefleri özetle.
2. Social auth kütüphanesi seçimi için bana 12 öneri sun (örnek: `social-auth-app-django` vs `django-allauth`), artılarını/eksilerini kısaca yaz ve **hangisini seçmek istediğimi sor**.
3. Ben seçimi yaptıktan sonra şu adımla başla:
- CustomUser model ve managerı yaz.
- `settings.py` içinde gerekli temel konfigürasyonları ekle (AUTH_USER_MODEL, Djoser, DRF, JWT, CORS, EMAIL).
- `COPILOT_MEMORY.md` dosyasına ilk kaydı ekle.
4. Her büyük adım sonunda:
- Hangi dosyaları değiştirdiğini kısaca özetle.
- `COPILOT_MEMORY.md`ye uygun formatta giriş ekle.
- Bir sonraki adımı bana öner ve onayımı bekle (veya devam etmemi iste).
Başlangıç komutum:
> **Başla**:
> - CustomUser model ve manager oluştur.
> - `settings.py` gerekli auth (Djoser + JWT + DRF + CORS + EMAIL) konfigürasyonlarını ekle.
> - Djoserın register/activate/jwt endpointlerini temel haliyle ayağa kaldıracak url ve ayarları hazırla.
> - `COPILOT_MEMORY.md` dosyasına başlangıç girdisini ekle.
Bu promptu anladıysan, önce kısaca özetle, sonra social auth kütüphane tercihi için benden seçim iste ve ardından adım 1e başla.

9
core/Permission.py Normal file
View File

@@ -0,0 +1,9 @@
from rest_framework.permissions import BasePermission, SAFE_METHODS
class ReadOnly(BasePermission):
"""
Yalnızca okuma işlemlerine izin verir.
"""
def has_permission(self, request, view):
# SAFE_METHODS: ('GET', 'HEAD', 'OPTIONS')
return request.method in SAFE_METHODS

0
core/__init__.py Normal file
View File

16
core/asgi.py Normal file
View File

@@ -0,0 +1,16 @@
"""
ASGI config for core project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
application = get_asgi_application()

18
core/celery.py Normal file
View File

@@ -0,0 +1,18 @@
import os
from celery import Celery
# Django ayarlarını yükle
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
app = Celery('core')
# Django ayarlarından 'CELERY_' ile başlayanları al
app.config_from_object('django.conf:settings', namespace='CELERY')
# Tüm uygulamalardaki tasks.py dosyalarını otomatik keşfet
app.autodiscover_tasks()
@app.task(bind=True)
def debug_task(self):
print(f'Request: {self.request!r}')

415
core/settings.py Normal file
View File

@@ -0,0 +1,415 @@
"""
Django settings for core 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
import os
# 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('SECRET_KEY', 'django-insecure-slih+3-7gn0b04-2wm4zq)rp*kz1jnt&bf9o3i3*8jhz*n9=2k')
# SECURITY WARNING: don't run with debug turned on in production!
# DEBUG = os.getenv('DEBUG', 'True') == 'True'
DEBUG = os.getenv('DEBUG', 'True').lower() == 'true'
# ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '127.0.0.1,localhost').split(',')
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', 'localhost,127.0.0.1,api.beyhano.net.tr,api.beyhano.com.tr').split(',')
CSRF_TRUSTED_ORIGINS = os.getenv('CSRF_TRUSTED_ORIGINS', 'https://beyhano.net.tr,https://api.beyhano.net.tr,https://api.beyhano.com.tr').split(',')
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 3. Parti
'django_extensions',
'rest_framework',
'rest_framework_simplejwt',
'djoser',
'corsheaders',
'social_django',
'imagekit',
'django_cleanup',
'colorfield',
'autoslug',
'tinymce',
'django.contrib.sites', # Added for Djoser domain resolution
# Local apps
'accounts',
'blog',
'backup.apps.BackupConfig',
'settings',
'utils',
'image.apps.ImageConfig',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'accounts.middleware.SocialAuthExceptionMiddleware',
]
SITE_ID = 1
ROOT_URLCONF = 'core.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates']
,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
# Social auth context processors
'social_django.context_processors.backends',
'social_django.context_processors.login_redirect',
],
},
},
]
WSGI_APPLICATION = 'core.wsgi.application'
# Database
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
# Docker ortamında veya environment değişkeni varsa PostgreSQL kullan
USE_POSTGRES = os.getenv('USE_POSTGRES', 'True').lower() == 'true'
if USE_POSTGRES:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('POSTGRES_DB', 'server_dj'),
'USER': os.getenv('POSTGRES_USER', 'cloud'),
'PASSWORD': os.getenv('POSTGRES_PASSWORD', 'gg7678290'),
'HOST': os.getenv('POSTGRES_HOST', '10.80.80.70'),
'PORT': os.getenv('POSTGRES_PORT', '5432'),
'OPTIONS': {
'options': '-c search_path=public'
},
}
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# redis://default:gg7678290@194.29.55.228:6379
# ==============================================================================
# REDIS CACHE CONFIGURATION
# ==============================================================================
CACHES = {
'default': {
'BACKEND': 'django_redis.cache.RedisCache',
# 'LOCATION': 'redis://default:1923btO**@ares-redis-xrot7z:6379',
'LOCATION': os.getenv('REDIS_URL', 'redis://default:gg7678290@10.80.80.70:6379'),
# 'LOCATION': os.getenv('REDIS_URL', 'redis://127.0.0.1:6379/1'),
'OPTIONS': {
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
},
'KEY_PREFIX': 'dj52',
'TIMEOUT': 300, # 5 dakika default timeout
}
}
# Password validation
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/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
STATICFILES_DIRS = [
BASE_DIR / 'static',
]
# Media files (User uploaded files)
MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR / 'media'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# Default primary key field type
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
AUTH_USER_MODEL = 'accounts.CustomUser'
# ==============================================================================
# REST FRAMEWORK CONFIGURATION
# ==============================================================================
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
'rest_framework.authentication.SessionAuthentication', # For social auth
),
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated',
],
# Throttling for security
'DEFAULT_THROTTLE_CLASSES': [
'rest_framework.throttling.AnonRateThrottle',
'rest_framework.throttling.UserRateThrottle',
],
'DEFAULT_THROTTLE_RATES': {
'anon': '100/hour', # Anonymous users
'user': '1000/hour', # Authenticated users
},
}
# ==============================================================================
# SIMPLE JWT CONFIGURATION
# ==============================================================================
from datetime import timedelta
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(days=30),
'REFRESH_TOKEN_LIFETIME': timedelta(days=120),
'ROTATE_REFRESH_TOKENS': True,
'BLACKLIST_AFTER_ROTATION': True,
'UPDATE_LAST_LOGIN': True,
'ALGORITHM': 'HS256',
'SIGNING_KEY': SECRET_KEY,
'VERIFYING_KEY': None,
'AUDIENCE': None,
'ISSUER': None,
'AUTH_HEADER_TYPES': ('Bearer',),
'AUTH_HEADER_NAME': 'HTTP_AUTHORIZATION',
'USER_ID_FIELD': 'id',
'USER_ID_CLAIM': 'user_id',
'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',),
'TOKEN_TYPE_CLAIM': 'token_type',
'JTI_CLAIM': 'jti',
}
# ==============================================================================
# DJOSER CONFIGURATION
# ==============================================================================
DJOSER = {
# Domain for email links (YOUR FRONTEND URL)
# Djoser combines DOMAIN + ACTIVATION_URL to create the full link
'DOMAIN': os.getenv('DJOSER_DOMAIN', 'localhost:3000'), # IMPORTANT: Change this to your frontend's domain
'SITE_NAME': os.getenv('DJOSER_SITE_NAME', 'Django Auth API'),
# Registration & Activation
'SEND_ACTIVATION_EMAIL': True,
'ACTIVATION_URL': 'activate/{uid}/{token}', # Frontend route, e.g., http://localhost:3000/activate/MQ/token/
# Password Reset
'SEND_CONFIRMATION_EMAIL': True,
'PASSWORD_RESET_CONFIRM_URL': 'password-reset/{uid}/{token}', # Frontend route
'PASSWORD_RESET_SHOW_EMAIL_NOT_FOUND': False,
# Username Reset
'USERNAME_RESET_CONFIRM_URL': 'username-reset/{uid}/{token}', # Frontend route
# Email confirmations
'PASSWORD_CHANGED_EMAIL_CONFIRMATION': True,
'USERNAME_CHANGED_EMAIL_CONFIRMATION': True,
# User settings
'USER_CREATE_PASSWORD_RETYPE': True,
'SET_PASSWORD_RETYPE': True,
'PASSWORD_RESET_CONFIRM_RETYPE': True,
'LOGIN_FIELD': 'email',
# Serializers
'SERIALIZERS': {
'user_create': 'accounts.serializers.CustomUserCreateSerializer',
'user': 'accounts.serializers.CustomUserSerializer',
'current_user': 'accounts.serializers.CustomUserSerializer',
},
}
# ==============================================================================
# EMAIL CONFIGURATION
# ==============================================================================
# Development: Using MailPit (local email testing tool)
# MailPit default runs on localhost:1025 for SMTP and localhost:8025 for web UI
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = os.getenv('EMAIL_HOST', '10.80.80.70')
EMAIL_PORT = int(os.getenv('EMAIL_PORT', 1025))
EMAIL_USE_TLS = os.getenv('EMAIL_USE_TLS', 'False').lower() == 'true'
EMAIL_USE_SSL = os.getenv('EMAIL_USE_SSL', 'False').lower() == 'true'
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER', '')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD', '')
DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'noreply@localhost')
CORS_ALLOWED_ORIGINS = os.getenv('CORS_ALLOWED_ORIGINS', 'http://localhost:3000,http://127.0.0.1:3000,http://localhost:5173,http://127.0.0.1:5173,http://localhost:8080,http://127.0.0.1:8080').split(',')
# For development only - be careful in production!
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
CORS_ALLOW_HEADERS = [
'accept',
'accept-encoding',
'authorization',
'content-type',
'dnt',
'origin',
'user-agent',
'x-csrftoken',
'x-requested-with',
]
# ==============================================================================
# SOCIAL AUTH CONFIGURATION (Python Social Auth)
# ==============================================================================
AUTHENTICATION_BACKENDS = (
# Social auth backends
'social_core.backends.google.GoogleOAuth2',
'social_core.backends.github.GithubOAuth2',
'social_core.backends.facebook.FacebookOAuth2',
# Add more providers as needed
# Django default
'django.contrib.auth.backends.ModelBackend',
)
# Social Auth Settings
SOCIAL_AUTH_JSONFIELD_ENABLED = True
SOCIAL_AUTH_URL_NAMESPACE = 'social'
# Pipeline - custom pipeline to set is_active=True for social users
SOCIAL_AUTH_PIPELINE = (
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
'social_core.pipeline.social_auth.social_user',
'social_core.pipeline.user.get_username',
'social_core.pipeline.user.create_user',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details',
'accounts.pipeline.activate_user', # Custom pipeline to set is_active=True
)
# User model
SOCIAL_AUTH_USER_MODEL = 'accounts.CustomUser'
SOCIAL_AUTH_USERNAME_IS_REQUIRED = False
SOCIAL_AUTH_USER_FIELDS = ['email', 'first_name', 'last_name']
# Strategy
SOCIAL_AUTH_STRATEGY = 'social_django.strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social_django.models.DjangoStorage'
# Google OAuth2 Configuration
# Get credentials from: https://console.developers.google.com/
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = os.getenv('SOCIAL_AUTH_GOOGLE_OAUTH2_KEY', '915364976256-691m0s87as2r5vdbqr96f6humblseobt.apps.googleusercontent.com') # Your Google Client ID
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = os.getenv('SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET', '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') # Your Google Client Secret
SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = [
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile',
]
SOCIAL_AUTH_GOOGLE_OAUTH2_EXTRA_DATA = ['first_name', 'last_name']
# GitHub OAuth2 Configuration
# Get credentials from: https://github.com/settings/developers
SOCIAL_AUTH_GITHUB_KEY = os.getenv('SOCIAL_AUTH_GITHUB_KEY', 'Ov23liUt9B61O46Mdfm4') # Your GitHub Client ID
SOCIAL_AUTH_GITHUB_SECRET = os.getenv('SOCIAL_AUTH_GITHUB_SECRET', 'c7fc8dcb1b2c8f22120608425d07d5efd995baaf') # Your GitHub Client Secret
SOCIAL_AUTH_GITHUB_SCOPE = ['user:email']
# Facebook OAuth2 Configuration
# Get credentials from: https://developers.facebook.com/
SOCIAL_AUTH_FACEBOOK_KEY = os.getenv('SOCIAL_AUTH_FACEBOOK_KEY', '') # Your Facebook App ID
SOCIAL_AUTH_FACEBOOK_SECRET = os.getenv('SOCIAL_AUTH_FACEBOOK_SECRET', '') # Your Facebook App Secret
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {
'fields': 'id, name, email, first_name, last_name'
}
# Redirect URLs (customize for your frontend)
LOGIN_URL = '/api/v1/spa/'
LOGIN_REDIRECT_URL = '/api/v1/auth/social/callback/'
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/api/v1/auth/social/callback/'
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/api/v1/auth/social/callback/'
SOCIAL_AUTH_INACTIVE_USER_URL = '/api/v1/auth/social/error/'
SOCIAL_AUTH_LOGIN_ERROR_URL = '/api/v1/auth/social/error/'
TASKS = {"default": {"BACKEND": "django.tasks.backends.immediate.ImmediateBackend"}}
# ==============================================================================
# SECURITY SETTINGS FOR SPA/JWT
# ==============================================================================
# Since we're using JWT tokens (not session cookies), we can relax CSRF for API endpoints
# But keep it enabled for Django admin
"""
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_SECURE = False # Set to True in production with HTTPS
SESSION_COOKIE_SECURE = False # Set to True in production with HTTPS
CSRF_TRUSTED_ORIGINS = [
"http://localhost:3000",
"http://localhost:5173",
]
"""
# TinyMCE Configuration
TINYMCE_DEFAULT_CONFIG = {
"height": "320px",
"width": "960px",
"menubar": "file edit view insert format tools table help",
"plugins": "advlist autolink lists link image charmap print preview anchor searchreplace visualblocks code fullscreen insertdatetime media table paste code help wordcount spellchecker",
"toolbar": "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist checkbox | forecolor backcolor casechange permanentpen formatpainter removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media pageembed template link anchor codesample | a11ycheck ltr rtl | showcomments addcomment",
"custom_undo_redo_levels": 10,
"language": "tr", # To force a specific language instead of the Django current language.
}

38
core/urls.py Normal file
View File

@@ -0,0 +1,38 @@
"""
URL configuration for core project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/6.0/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
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
# Main API routes (includes SPA pages)
path('api/v1/', include('accounts.urls')),
path('api/v1/blog/', include('blog.urls')),
path('api/v1/', include('settings.urls')),
path('api/v1/', include('utils.urls')),
path('api/v1/images/', include('image.urls')),
path('tinymce/', include('tinymce.urls')),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

40
core/utils.py Normal file
View File

@@ -0,0 +1,40 @@
import os
import uuid
from django.utils.deconstruct import deconstructible
from imagekit.processors import ResizeToFill
class ConvertToRGBA(object):
"""Converts an image to RGBA mode."""
def process(self, img):
if img.mode not in ('RGBA', 'LA'):
img = img.convert('RGBA')
return img
@deconstructible
class UniquePathAndRename(object):
def __init__(self, upload_to):
self.upload_to = upload_to
def __call__(self, instance, filename):
ext = filename.split('.')[-1]
new_filename = f"{uuid.uuid4().hex}.{ext}"
return os.path.join(self.upload_to, new_filename)
def image_optimizer(upload_to, width, height, quality, img_format):
"""
ProcessedImageField için gerekli olan `upload_to`, `processors`, `format`
ve `options` parametrelerini dinamik olarak oluşturur.
"""
processors = [ResizeToFill(width, height)]
if img_format == 'PNG':
processors.insert(0, ConvertToRGBA())
return {
'upload_to': UniquePathAndRename(upload_to),
'processors': processors,
'format': img_format,
'options': {'quality': quality}
}

16
core/wsgi.py Normal file
View File

@@ -0,0 +1,16 @@
"""
WSGI config for core project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
application = get_wsgi_application()

1
dene.txt Normal file
View File

@@ -0,0 +1 @@
https://easypanel.io/

111
docker-compose.c.yml Normal file
View File

@@ -0,0 +1,111 @@
services:
web:
build:
context: .
dockerfile: ./build/Dockerfile
container_name: django_web_prod
command: gunicorn core.wsgi:application --bind 0.0.0.0:8000 --workers 3
dns:
- 8.8.8.8
- 8.8.4.4
volumes:
- static_volume:/app/staticfiles
- media_volume:/app/media
expose:
- 8000
networks:
coolify:
aliases:
- django_web_prod
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000/ || exit 1"]
interval: 10s
timeout: 5s
retries: 5
environment:
- DEBUG=0
- SECRET_KEY=${SECRET_KEY}
- USE_POSTGRES=${USE_POSTGRES}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST:-10.80.80.50}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- DJANGO_ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND}
restart: unless-stopped
celery:
build:
context: .
dockerfile: ./build/Dockerfile
container_name: django_celery_prod
command: celery -A core worker -l info
dns:
- 8.8.8.8
- 8.8.4.4
volumes:
- media_volume:/app/media
networks:
- coolify
environment:
- DEBUG=0
- SECRET_KEY=${SECRET_KEY}
- USE_POSTGRES=${USE_POSTGRES}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST:-10.80.80.50}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- DJANGO_ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND}
depends_on:
- web
healthcheck:
test: ["CMD-SHELL", "celery -A core inspect ping"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
caddy:
build:
context: .
dockerfile: ./caddy/Dockerfile
container_name: django_caddy
expose:
- 80
networks:
coolify:
aliases:
- nginx
- nginx_proxy
volumes:
- static_volume:/app/staticfiles:ro
- media_volume:/app/media:ro
- caddy_data:/data
- caddy_config:/config
depends_on:
- web
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
labels:
- "coolify.managed=true"
- "coolify.http.port=80"
volumes:
static_volume:
media_volume:
caddy_data:
caddy_config:
networks:
coolify:
external: true

58
docker-compose.cool.yml Normal file
View File

@@ -0,0 +1,58 @@
services:
web:
build:
context: .
dockerfile: ./build/Dockerfile
container_name: django_web_prod
command: gunicorn core.wsgi:application --bind 0.0.0.0:8000 --workers 3
dns:
- 8.8.8.8
- 8.8.4.4
volumes:
- static_volume:/app/staticfiles
- media_volume:/app/media
expose:
- 8000
environment:
- DEBUG=0
- SECRET_KEY=${SECRET_KEY}
- USE_POSTGRES=${USE_POSTGRES}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST:-212.64.215.243}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- DJANGO_ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND}
restart: unless-stopped
celery:
build:
context: .
dockerfile: ./build/Dockerfile
container_name: django_celery_prod
command: celery -A core worker -l info
dns:
- 8.8.8.8
- 8.8.4.4
volumes:
- media_volume:/app/media
environment:
- DEBUG=0
- SECRET_KEY=${SECRET_KEY}
- USE_POSTGRES=${USE_POSTGRES}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST:-212.64.215.243}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- DJANGO_ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND}
depends_on:
- web
restart: unless-stopped
volumes:
static_volume:
media_volume:

90
docker-compose.d.yml Normal file
View File

@@ -0,0 +1,90 @@
services:
web:
build:
context: .
dockerfile: ./build/Dockerfile
container_name: django_web_prod
command: gunicorn core.wsgi:application --bind 0.0.0.0:8000 --workers 3
dns:
- 8.8.8.8
- 8.8.4.4
volumes:
- static_volume:/app/staticfiles
- media_volume:/app/media
expose:
- 8000
networks:
- dokploy-network
environment:
- DEBUG=0
- SECRET_KEY=${SECRET_KEY}
- USE_POSTGRES=${USE_POSTGRES}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST:-10.80.80.50}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- DJANGO_ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND}
restart: unless-stopped
celery:
build:
context: .
dockerfile: ./build/Dockerfile
container_name: django_celery_prod
command: celery -A core worker -l info
dns:
- 8.8.8.8
- 8.8.4.4
volumes:
- media_volume:/app/media
networks:
- dokploy-network
environment:
- DEBUG=0
- SECRET_KEY=${SECRET_KEY}
- USE_POSTGRES=${USE_POSTGRES}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST:-10.80.80.50}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- DJANGO_ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS}
- CELERY_BROKER_URL=${CELERY_BROKER_URL}
- CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND}
depends_on:
- web
restart: unless-stopped
caddy:
build:
context: .
dockerfile: ./caddy/Dockerfile
container_name: django_caddy
expose:
- 80
networks:
- dokploy-network
volumes:
- static_volume:/app/staticfiles:ro
- media_volume:/app/media:ro
- caddy_data:/data
- caddy_config:/config
depends_on:
- web
restart: unless-stopped
labels:
- "coolify.managed=true"
- "coolify.http.port=80"
volumes:
static_volume:
media_volume:
caddy_data:
caddy_config:
networks:
dokploy-network:
external: true

Some files were not shown because too many files have changed in this diff Show More