我正在尝试部署我的Django web应用程序,但我遇到了一些错误。我学习了一些教程,但它们没有帮助我。此外,我有所有必要的文件,如Procfile,requirements.txt。甚至我也试图将STATIC_ROOT改为staticfiles和static,但没有效果。
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_4dca6fca/static'
Error while running '$ python manage.py collectstatic --noinput'.
See traceback above for details.
You may need to update application code to resolve this error.
Or, you can disable collectstatic for this application:
$ heroku config:set DISABLE_COLLECTSTATIC=1
https://devcenter.heroku.com/articles/django-assets
Push rejected, failed to compile Python app.
Push failedsettings.py
DEBUG = False
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware', # added whitenoise
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'Procfile
web: gunicorn portfolio.wsgi --log-file -发布于 2022-02-22 13:21:42
尝试在BASE_DIR中更改settings.py变量
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))https://stackoverflow.com/questions/66745864
复制相似问题