diff --git a/Rasaddam_Backend/settings.py b/Rasaddam_Backend/settings.py index b63b088..be92d4a 100644 --- a/Rasaddam_Backend/settings.py +++ b/Rasaddam_Backend/settings.py @@ -25,7 +25,7 @@ SECRET_KEY = 'django-insecure-@0apn-lk85pfw=z00x2ib$w9#rwz8%2v4i_n^^9jz-m9b+y55* # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'https://rasadyar.net/'] # Application definition @@ -37,6 +37,8 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + "rest_framework", + "corsheaders", ] MIDDLEWARE = [ @@ -114,6 +116,7 @@ USE_I18N = True USE_TZ = True +DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S' # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/5.2/howto/static-files/ @@ -124,3 +127,70 @@ STATIC_URL = 'static/' # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +DATA_UPLOAD_MAX_MEMORY_SIZE = 50242880 + +CORS_ORIGIN_ALLOW_ALL = True + +CORS_ORIGIN_WHITELIST = ( + 'http://localhost:8080', + 'http://127.0.0.1:8080', + 'http://127.0.0.1:3000', + 'http://localhost:3000', + 'https://rasadyar.net' +) + +CORS_ALLOWED_ORIGINS = ( + 'http://localhost:8080', + 'http://127.0.0.1:8080', + 'http://127.0.0.1:3000', + 'http://localhost:3000', + 'https://rasadyar.net' +) + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'standard': { + 'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", + 'datefmt': "%d/%b/%Y %H:%M:%S" + }, + }, + 'handlers': { + 'logfile': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': BASE_DIR / "logfile.log", + 'maxBytes': 50000, + 'backupCount': 2, + 'formatter': 'standard', + }, + 'console': { + 'level': 'INFO', + 'class': 'logging.StreamHandler', + 'formatter': 'standard' + }, + }, + 'loggers': { + 'django': { + 'handlers': ['console'], + 'propagate': True, + 'level': 'WARN', + }, + 'django.db.backends': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + '': { + 'handlers': ['console', 'logfile'], + 'level': 'DEBUG', + }, + } +} + +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') +SECURE_SSL_REDIRECT = False +SESSION_COOKIE_SECURE = False +CSRF_COOKIE_SECURE = False