Django 6 + DRF resource server against the Gooyal accounts OAuth2 service, matching the Winsoo ecosystem's conventions. Covers locations, stores, catalog, cart, checkout/orders (with the multi-store-cart split and the status stepper), reviews, and notifications, plus a demo-data seed command. Payment integration (wallet debits, online gateway, seller payouts) is intentionally left out here — see feature/payment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
90 lines
2.4 KiB
Python
90 lines
2.4 KiB
Python
import os
|
|
|
|
|
|
def get_settings(key):
|
|
from django.conf import settings
|
|
return getattr(settings, key)
|
|
|
|
|
|
BASE_DIR = get_settings('BASE_DIR')
|
|
|
|
LOG_DIR = BASE_DIR / 'log'
|
|
if not os.path.exists(LOG_DIR):
|
|
os.makedirs(LOG_DIR)
|
|
|
|
LOGGING = {
|
|
'version': 1,
|
|
'disable_existing_loggers': False,
|
|
'formatters': {
|
|
'verbose': {
|
|
'format': '{asctime} [{levelname}] {name} {module} {process:d} {thread:d} {message}',
|
|
'style': '{',
|
|
},
|
|
'standard': {
|
|
'format': '{asctime} [{levelname}] {name}: {message}',
|
|
'style': '{',
|
|
},
|
|
'simple': {
|
|
'format': '{levelname} {message}',
|
|
'style': '{',
|
|
},
|
|
},
|
|
'filters': {
|
|
'require_debug_true': {
|
|
'()': 'django.utils.log.RequireDebugTrue',
|
|
},
|
|
'require_debug_false': {
|
|
'()': 'django.utils.log.RequireDebugFalse',
|
|
},
|
|
},
|
|
'handlers': {
|
|
'file': {
|
|
'level': 'INFO',
|
|
'class': 'logging.handlers.TimedRotatingFileHandler',
|
|
'filename': os.path.join(LOG_DIR, 'winofy.log'),
|
|
'when': 'midnight',
|
|
'interval': 5,
|
|
'backupCount': 30,
|
|
'formatter': 'verbose',
|
|
'encoding': 'utf-8',
|
|
},
|
|
'error_file': {
|
|
'level': 'ERROR',
|
|
'class': 'logging.handlers.TimedRotatingFileHandler',
|
|
'filename': os.path.join(LOG_DIR, 'errors.log'),
|
|
'when': 'midnight',
|
|
'interval': 5,
|
|
'backupCount': 30,
|
|
'formatter': 'verbose',
|
|
'encoding': 'utf-8',
|
|
},
|
|
'console': {
|
|
'level': 'DEBUG',
|
|
'filters': ['require_debug_true'],
|
|
'class': 'logging.StreamHandler',
|
|
'formatter': 'simple',
|
|
},
|
|
'console_always': {
|
|
'level': 'INFO',
|
|
'class': 'logging.StreamHandler',
|
|
'formatter': 'standard',
|
|
},
|
|
},
|
|
'loggers': {
|
|
'': {
|
|
'handlers': ['console', 'file', 'error_file'],
|
|
'level': 'INFO',
|
|
'propagate': True,
|
|
},
|
|
'django': {
|
|
'handlers': ['console', 'file'],
|
|
'level': 'INFO',
|
|
'propagate': False,
|
|
},
|
|
'django.request': {
|
|
'handlers': ['file', 'error_file', 'console'],
|
|
'level': 'ERROR',
|
|
'propagate': False,
|
|
},
|
|
},
|
|
}
|