Skip to content

Commit c07af46

Browse files
committed
Added: vercel files
1 parent a158a8e commit c07af46

File tree

5 files changed

+76
-0
lines changed

5 files changed

+76
-0
lines changed

__init__.py

Whitespace-only changes.

build.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
echo "Upgrade pip..."
4+
python -m pip install --upgrade pip
5+
6+
echo "Installing dependencies..."
7+
python -m pip install -r requirements.txt
8+
9+
# echo "Migrating database..."
10+
# python manage.py makemigrations --noinput
11+
# python manage.py migrate --noinput
12+
13+
# echo "Creating superuser..."
14+
15+
# DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL}
16+
# DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME}
17+
# DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD}
18+
19+
# python manage.py createsuperuser \
20+
# --email $DJANGO_SUPERUSER_EMAIL \
21+
# --noinput || true
22+
23+
echo "Running npm install..."
24+
pnpm bootstrap
25+
26+
echo "Running npm Production..."
27+
pnpm collect
28+
29+
echo "Collecting static files..."
30+
python src/manage.py collectstatic --noinput --clear

main.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
import sys
3+
import pathlib
4+
5+
BASE_DIR = pathlib.Path(__file__).resolve().parent
6+
7+
PATHS = [str(BASE_DIR / "src"),]
8+
9+
sys.path.extend(PATHS)
10+
11+
os.environ["DJANGO_SETTINGS_MODULE"] = "backend.settings"
12+
13+
import django
14+
15+
django.setup()
16+
17+
from django.core.wsgi import get_wsgi_application
18+
19+
app = get_wsgi_application()

src/__init__.py

Whitespace-only changes.

vercel.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": 2,
3+
"builds": [
4+
{
5+
"src": "main.py",
6+
"use": "@vercel/python"
7+
},
8+
{
9+
"src": "build.sh",
10+
"use": "@vercel/static-build",
11+
"config": {
12+
"distDir": "staticfiles_build"
13+
}
14+
}
15+
],
16+
"routes": [
17+
{
18+
"src": "/static/(.*)",
19+
"headers": { "cache-control": "s-maxage=31536000, immutable" },
20+
"dest": "/static/$1"
21+
},
22+
{
23+
"src": "/(.*)",
24+
"dest": "main.py"
25+
}
26+
]
27+
}

0 commit comments

Comments
 (0)