build_files.sh: (fromat1)
echo " BUILD START"
python3.9 -m install -r requirements.txt
python3.9 manage.py collectstatic
echo "BUILD END"
build_files.sh: (fromat2)
pip install -r requirements.txt
python3.9 manage.py collectstatic
By both formats of build_files.sh I’m getting same error
my settings:
ALLOWED_HOSTS = ['.vercel.app', '.now.sh']
STATIC_URL = 'static/'
STATICFILES_DIRS = os.path.join(BASE_DIR, 'static')
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles', 'static')
MEDIA_URL = 'media/'
MEDIA_ROOT = 'media/'
vercel.json:
{
"builds": [{
"src": "config/wsgi.py",
"use": "@vercel/python",
"config": { "maxLambdaSize": "15mb", "runtime": "python3.9"}
},
{
"src": "build_files.sh",
"use": "@vercel/static-build",
"config": {
"disDir": "staticfiles"
}
}
],
"routes": [
{
"src": "/static/(.*)",
"dest": "/static/$1"
},
{
"src": "/(.*)",
"dest": "config/wsgi.py"
}
]
}
error:
23:55:19.603] Running build in Washington, D.C., USA (East) – iad1
[23:55:19.865] Cloning github.com/mirolim-dev/TTJ (Branch: mirolim, Commit: 4f62e4b)
[23:55:20.338] Previous build cache not available
[23:55:20.694] Cloning completed: 829.258ms
[23:55:21.303] Running “vercel build”
[23:55:22.104] Vercel CLI 34.1.8
[23:55:22.428] WARN! Due tobuilds
existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: Error Codes
[23:55:23.204] ./build_files.sh: line 1: pip: command not found
[23:55:23.253] Traceback (most recent call last):
[23:55:23.254] File “/vercel/path0/manage.py”, line 11, in main
[23:55:23.254] from django.core.management import execute_from_command_line
[23:55:23.254] ModuleNotFoundError: No module named ‘django’
[23:55:23.254]
[23:55:23.254] The above exception was the direct cause of the following exception:
[23:55:23.254]
[23:55:23.254] Traceback (most recent call last):
[23:55:23.254] File “/vercel/path0/manage.py”, line 22, in
[23:55:23.254] main()
[23:55:23.254] File “/vercel/path0/manage.py”, line 13, in main
[23:55:23.254] raise ImportError(
[23:55:23.254] ImportError: Couldn’t import Django. Are you sure it’s installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
[23:55:23.260] Error: Command “./build_files.sh” exited with 1
[23:55:23.660]