diff --git a/myproject/myapp/static/js/languages.js b/myproject/myapp/static/js/languages.js deleted file mode 100644 index 131ef15..0000000 --- a/myproject/myapp/static/js/languages.js +++ /dev/null @@ -1,5 +0,0 @@ -document.addEventListener('DOMContentLoaded', function() { - document.getElementById('language-select').addEventListener('change', function() { - document.getElementById('language-form').submit(); - }); -}); diff --git a/myproject/myproject/settings.py b/myproject/myproject/settings.py index f436818..29b1829 100644 --- a/myproject/myproject/settings.py +++ b/myproject/myproject/settings.py @@ -18,10 +18,8 @@ # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent - -STATICFILES_DIRS = [ - BASE_DIR / 'myapp' / 'static', -] +STATICFILES_DIRS = [BASE_DIR / 'myapp' / 'static'] +STATIC_ROOT = BASE_DIR / 'staticfiles_build' # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ @@ -30,21 +28,17 @@ SECRET_KEY = os.environ.get('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = ['*'] +DEBUG = False +ALLOWED_HOSTS = ['.vercel.app', '.now.sh'] # X-Content-Type-Options SECURE_BROWSER_XSS_FILTER = True - SECURE_HSTS_SECONDS = 31536000 - SECURE_HSTS_INCLUDE_SUBDOMAINS = True - SECURE_HSTS_PRELOAD = True - SECURE_CONTENT_TYPE_NOSNIFF = True +SECURE_SSL_REDIRECT = True # Application definition @@ -98,10 +92,10 @@ # https://docs.djangoproject.com/en/5.0/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } + # 'default': { + # 'ENGINE': 'django.db.backends.sqlite3', + # 'NAME': BASE_DIR / 'db.sqlite3', + # } } # Password validation @@ -126,9 +120,7 @@ # https://docs.djangoproject.com/en/5.0/topics/i18n/ LANGUAGE_CODE = 'en-us' - TIME_ZONE = 'UTC' - USE_TZ = True # Static files (CSS, JavaScript, Images) diff --git a/myproject/myproject/wsgi.py b/myproject/myproject/wsgi.py index d4d3c81..37bfda0 100644 --- a/myproject/myproject/wsgi.py +++ b/myproject/myproject/wsgi.py @@ -14,3 +14,5 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings') application = get_wsgi_application() + +app = application \ No newline at end of file diff --git a/myproject/vercel.json b/myproject/vercel.json new file mode 100644 index 0000000..be4fac4 --- /dev/null +++ b/myproject/vercel.json @@ -0,0 +1,26 @@ +{ + "builds": [ + { + "src": "myproject/wsgi.py", + "use": "@vercel/python", + "config": { "maxLambdaSize": "15mb", "runtime": "python3.12" } + }, + { + "src": "build_files.sh", + "use": "@vercel/static-build", + "config": { + "distDir": "staticfiles_build" + } + } + ], + "routes": [ + { + "src": "/static/(.*)", + "dest": "/static/$1" + }, + { + "src": "/(.*)", + "dest": "myproject/wsgi.py" + } + ] +}