I have a simple Django project deployed with Cloud Foundry. The admin interface (the only interface used by my simple project) looks fine when running locally. When deployed, however, the CSS is visibly broken. The URLs for the CSS and JS assets return 404.
Other answers to similar questions say that the solution is the collectstatic
command. To run this in the context of Cloud Foundry, I type the following (obviously with the real app name and path):
cf run-task app-name -c "python app-path/manage.py collectstatic"
The output logged from this looks very promising:
128 static files copied to '/home/...path.../settings/static'.
Yet, in spite of this apparent promise, the CSS is still broken.
FYI, my settings include this:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
STATIC_URL = '/static/'
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')