简体   繁体   中英

serving static files in heroku with django

I'm deploying a Django app in heroku, but the static files doesnt work. I was looking I i suppose that I have the right configuration.

settings.py

import os
RUTA_PROYECTO = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(RUTA_PROYECTO,'static'),
)

wsgi.py

import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Portafolio6.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

But this still not working. Please help.

当我将Django应用程序部署到Heroku时,我也遇到了自动运行没有自动运行的问题,但暂时修复至少是将python manage.py collectstatic --noinput添加到你的Procfile ,例如

web: python my_django_app/manage.py collectstatic --noinput ; gunicorn --bind 0.0.0.0:$PORT my_django_app.wsgi:application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM