- Create missing templates app urls.py - Fix REST_FRAMEWORK pagination settings - Add DEFAULT_AUTO_FIELD configuration - Create migration files for all apps - Fix auto-generated model warnings - Verify database setup with test project
82 lines
1.7 KiB
Python
82 lines
1.7 KiB
Python
"""
|
|
Django settings for poker_api project.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
import os
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
SECRET_KEY = 'django-insecure-poker-design-local-dev-key-change-in-production'
|
|
|
|
DEBUG = True
|
|
|
|
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.staticfiles',
|
|
'rest_framework',
|
|
'corsheaders',
|
|
'apps.projects',
|
|
'apps.templates',
|
|
'apps.exports',
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'corsheaders.middleware.CorsMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'poker_api.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.request',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'poker_api.wsgi.application'
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': BASE_DIR / 'db.sqlite3',
|
|
}
|
|
}
|
|
|
|
LANGUAGE_CODE = 'zh-hans'
|
|
TIME_ZONE = 'Asia/Shanghai'
|
|
USE_I18N = True
|
|
USE_TZ = True
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
STATIC_URL = 'static/'
|
|
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_ROOT = BASE_DIR / 'media'
|
|
|
|
CORS_ALLOWED_ORIGINS = [
|
|
"http://localhost:5173",
|
|
"http://127.0.0.1:5173",
|
|
]
|
|
|
|
CORS_ALLOW_CREDENTIALS = True
|
|
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
|
'PAGE_SIZE': 20,
|
|
}
|