I have a Mac running OS X 10.9.3. I am trying to setup a Django application backed by a PostgreSQL database served by gunicorn, with static assets served by NGINX. I'm an old hand at Django with MySQL running with the developement server (manage.py runserver
). But I'm new to setting it up with virtualenv, gunicorn and NGINX. So I'm following the instructions here.
My Django Project is being served successfully at http://localhost:3026
. As a test of the database connectivity, I wanted to take a look at the Django Admin interface. I visited http://localhost:3026/admin/
. I have included a screenshot below.
Why does this admin page look so ugly? It lacks the neccessary graphical interface and css that it is supposed to have? It looks like NGINX is not properly serving up those static assets. How can I troubleshoot and fix this issue?
I even did python manage.py collectstatic
. That went and successfully copied all the static files to where they were supposed to (I think?) live in /opt/myenv/static
. You can see the output of that command here. I then re-started gunicorn and nginx. I thought that would fix it. But unfortunately it didn't. The issue remains. In my Django settings.py file, I have configured the STATIC variables as follows:
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'djangobower.finders.BowerFinder',
)
STATIC_ROOT = "/opt/myenv/static/"
STATIC_URL = '/static/'