Skip to content

Commit ed9d16c

Browse files
author
Gowthaman D
committed
vercel set up
1 parent 3385157 commit ed9d16c

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

build_files.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pip install -r requirements.txt
2+
python3.9 manage.py collectstatic --noinput

mysite/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
# SECURITY WARNING: don't run with debug turned on in production!
2525
DEBUG = True
2626

27-
ALLOWED_HOSTS = ['*']
27+
#ALLOWED_HOSTS = ['*']
28+
ALLOWED_HOSTS = ['.vercel.app', '.now.sh']
2829

2930
# Application definition
3031

mysite/wsgi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@
1414
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
1515

1616
application = get_wsgi_application()
17+
18+
app = application

vercel.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
{
2+
"version": 2,
23
"builds": [
34
{
45
"src": "mysite/wsgi.py",
5-
"use": "@vercel/python"
6+
"use": "@vercel/python",
7+
"config": {
8+
"maxLambdaSize": "15mb",
9+
"runtime": "python3.9"
10+
}
11+
},
12+
{
13+
"src": "build_files.sh",
14+
"use": "@vercel/static-build",
15+
"config": {
16+
"distDir": "staticfiles"
17+
}
618
}
719
],
820
"routes": [
21+
{
22+
"src": "/static/(.*)",
23+
"dest": "/static/$1"
24+
},
925
{
1026
"src": "/(.*)",
1127
"dest": "mysite/wsgi.py"
1228
}
1329
]
14-
}
30+
}

0 commit comments

Comments
 (0)