我有一个应用程序我想部署在Heroku上。还没有完成,但现在是我老师的要求了。我在heroku上创建了一个帐户和应用程序,并使用了GitHub部署方法,但是当我单击deploy分支时,会出现以下类型的错误:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_0f3c3e792cd2015b5d316aad8cf28d6c/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, 你能帮我理解错误并解决吗?
如果可能的话,我想使用这种部署方法,因为我在git方面也是个乞丐,现在我想避免使用CLI。
谢谢,
编辑:按需要粘贴Requirements.txt:
asgiref==3.2.3
Brotli==1.0.7
certifi==2020.4.5.1
chardet==3.0.4
dj-database-url==0.5.0
Django==3.0.3
django-crispy-forms==1.9.0
django-heroku==0.3.1
gunicorn==20.0.4
idna==2.9
psycopg2==2.8.5
pytz==2019.3
requests==2.23.0
six==1.14.0
sqlparse==0.3.0
urllib3==1.25.9
whitenoise==5.0.1发布于 2020-05-16 11:17:25
我不知道您的设置是什么状态,但是要确保您的静态urls都是在settings.py中创建的。特别是STATICFILES_DIRS,它将设置一个地方收集静力学为生产。
请跟随这个Heroku KB:https://devcenter.heroku.com/articles/django-assets
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)然后,它应该收集静态在正确的文件夹。让我知道。
发布于 2020-05-16 11:52:02
请使用白雪公主在heroku上部署静态文件。
https://stackoverflow.com/questions/61825042
复制相似问题