Skip to content

Commit e2f128e

Browse files
for vercel
1 parent d8d844e commit e2f128e

File tree

5 files changed

+40
-4
lines changed

5 files changed

+40
-4
lines changed

build_files.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pip install -r requirements.txt
2+
python3.9 manage.py collectstatic
255 Bytes
Binary file not shown.

core/settings.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# SECURITY WARNING: don't run with debug turned on in production!
2626
DEBUG = True
2727

28-
ALLOWED_HOSTS = []
28+
ALLOWED_HOSTS = ['.vercel.app','now.sh','127.0.0.1','localhost']
2929

3030

3131
# Application definition
@@ -86,8 +86,12 @@
8686

8787
DATABASES = {
8888
'default': {
89-
'ENGINE': 'django.db.backends.sqlite3',
90-
'NAME': BASE_DIR / 'db.sqlite3',
89+
'ENGINE': 'django.db.backends.postgresql',
90+
'NAME': 'railway',
91+
'USER': 'postgres',
92+
'PASSWORD': '44**d4c3Aeg3Ag-CdEAFCdeE45BeA1gC',
93+
'HOST': 'roundhouse.proxy.rlwy.net',
94+
'PORT': '22493',
9195
}
9296
}
9397

@@ -128,6 +132,9 @@
128132

129133
STATIC_URL = 'static/'
130134

135+
STATICFILES_DIRS = os.path.join(BASE_DIR, 'static'),
136+
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static')
137+
131138
# Default primary key field type
132139
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
133140

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ Twisted==23.10.0
2626
txaio==23.1.1
2727
typing_extensions==4.8.0
2828
zope.interface==6.1
29-

vercel.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"version": 2,
3+
"builds": [
4+
{
5+
"src": "core/asgi.py",
6+
"use": "@vercel/python",
7+
"config": { "maxLambdaSize": "15mb", "runtime": "python3.9" }
8+
},
9+
{
10+
"src": "build_files.sh",
11+
"use": "@vercel/static-build",
12+
"config": {
13+
"distDir": "staticfiles_build"
14+
}
15+
}
16+
],
17+
"routes": [
18+
{
19+
"src": "/static/(.*)",
20+
"dest": "/static/$1"
21+
},
22+
{
23+
"src": "/(.*)",
24+
"dest": "core/asgi.py"
25+
}
26+
]
27+
}
28+

0 commit comments

Comments
 (0)