WebFaction
Community site: login faq

Hello, I'm deploying my first django app, so please bear with me :)

I am encountering a 404 error (NGINX) when attempting to serve static media from within my app.

Per these instructions: http://docs.webfaction.com/software/django/config.html#serving-django-static-media

Here is my settings.py:

==============================================
STATIC_ROOT = 'home/austinrivas/webapps/static_media/'

STATIC_URL = 'http://austinrivas.webfactional.com/static/'

ADMIN_MEDIA_PREFIX = 'http://austinrivas.webfactional.com/static/admin/'
===============================================

I then executed python2.7 manage.py collectstatic

Now blog->myproject contains a dircetory called 'home' which appears to be an exact duplicate of my file structure leading up to the static files ( which I suppose is the expected result )

Obviously I receive 404 errors when attempting to retrieve any static files.

I think a symlink might do the trick, but I am hesitant to employ that because it shoots all of my attempts to decouple this application right in the foot.

Any help would be appreciated, Austin

asked 17 Nov '11, 19:33

Austin Rivas
1313
accept rate: 0%

edited 17 Nov '11, 22:13

ryans ♦♦
5.0k93360

I apologize for the format errors, something weird happened when I pasted it over :(

(17 Nov '11, 22:07) Austin Rivas

no worries - we fixed the formatting and are now looking into it.

(17 Nov '11, 22:13) ryans ♦♦

The problem is that you used:

STATIC_ROOT = 'home/austinrivas/webapps/static_media/'

instead of

STATIC_ROOT = '/home/austinrivas/webapps/static_media/'

The first one is a relative path, which explains why the manage.py collectstatic command created a new "home" directory in the current directory with a new filepath leading up to your static files. That's not normal.

Instead, just delete that "home" directory, fix STATIC_ROOT, and then run python2.7 manage.py collectstatic again. This time your static files should be placed in the correct location, which is /home/austinrivas/webapps/static_media/ .

Hope that helps!

permanent link

answered 17 Nov '11, 22:23

ryans ♦♦
5.0k93360
accept rate: 43%

1

Gracias, That solved it right off the bat. I would vote you up but I don't have enough rep yet :(

(18 Nov '11, 13:05) Austin Rivas
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×125
×108
×22

question asked: 17 Nov '11, 19:33

question was seen: 2,843 times

last updated: 18 Nov '11, 13:05

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM