Cris Towi
Cris Towi

Reputation: 1211

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.

Upvotes: 0

Views: 2519

Answers (1)

3cheesewheel
3cheesewheel

Reputation: 9663

I've also been running into issues with collectstatic not running automatically when I deploy my Django app to Heroku, but a temporary fix at least would be to add python manage.py collectstatic --noinput to your Procfile, e.g.

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

Upvotes: 2

Related Questions