Last active
January 5, 2024 15:07
-
-
Save coderboy-raiyan/e5f24e64b57ed327e0b85f6dedd36ad1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vercel.json | |
{ | |
"version": 2, | |
"builds": [ | |
{ | |
"src": "myweb/wsgi.py", | |
"use": "@vercel/python", | |
"config": { "maxLambdaSize": "15mb", "runtime": "python3.9" } | |
}, | |
{ | |
"src": "build_files.sh", | |
"use": "@vercel/static-build", | |
"config": { | |
"distDir": "staticfiles_build" | |
} | |
} | |
], | |
"routes": [ | |
{ | |
"src": "/static/(.*)", | |
"dest": "/static/$1" | |
}, | |
{ | |
"src": "/(.*)", | |
"dest": "myweb/wsgi.py" | |
} | |
] | |
} | |
-------Not necessary----- | |
build_files.sh | |
pip install -r requirements.txt | |
python3.9 manage.py collectstatic | |
--------------------------- | |
settings.py | |
------------- | |
ALLOWED_HOSTS = ['.vercel.app','now.sh','127.0.0.1','localhost'] | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql', | |
'NAME': env("DB_NAME"), | |
'USER': env("DB_USER"), | |
'PASSWORD': env("DB_PASSWORD"), | |
'HOST': env("DB_HOST"), | |
'PORT': env("DB_PORT"), | |
} | |
} | |
STATICFILES_DIRS = os.path.join(BASE_DIR, 'static'), | |
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_build', 'static') | |
urls.py | |
--------- | |
urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT) | |
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) | |
wsgi.py | |
------- | |
app = application | |
### Must remove the psycopg2 from your requiremnets.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment