2

It's nearly the same question as this:

Missing bootstrap resources in Django-Rest-Framework

and Django -- Can't get static CSS files to load

So it seems that this may be a more common issue. I checked my settings with the first one and I am not using runserver for the 2nd one.

My settings: DEBUG = False

and installed apps includes: 'django.contrib.staticfiles',

I am running django 1.5 and the latest version of django-rest 2.3.8, using uwsgi + nginx on a Ubuntu 12.04 LTS. The API themselves are being served but the bootstrap and css files are not. When i click into the link in some API and check out the source code for: href = /static/rest_framework/css/bootstrap.min.css

I get the default django 404 url not found.

I think I just missed a step somewhere in the installation but I can't figure out where.

1
  • This kind of posts should always include the parts of template where you have descibed static files paths. Commented Nov 12, 2013 at 10:04

3 Answers 3

3

I find a simple way to solve it.I guess you must use the uwsgi and nginx. uwsgi can't find the rest_framework static file. you can add the following to your nginx config file:

location /static/rest_framework/ {
alias /yourdjangoproject/lib/python2.7/site-packages/rest_framework/static/rest_framework/;}
Sign up to request clarification or add additional context in comments.

Comments

0

This problem is most likely something like using {{ STATIC_ROOT }} not {{ STATIC_URL }} in path, just like the links you refer to say.

Comments

0

Did you run collectstatic ? If so, you don't have to alias DRF's static files.

Hope it helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.