Home:ALL Converter>django static files getting a 404

django static files getting a 404

Ask Time:2015-01-12T11:32:41         Author:Tyler

Json Formatter

I can't seem to get django static files working when I visit /static/accept.png it returns a 404. I have the file in project_folder/static

My installed apps has static files included

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
)

and this is what setting up the static files looks like

import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

PROJECT_PATH = os.path.join(BASE_DIR, os.pardir)
PROJECT_PATH = os.path.abspath(PROJECT_PATH)

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_PATH = os.path.join(PROJECT_PATH,'static')

STATIC_URL = '/static/' # You may find this is already defined as such.

STATICFILES_DIRS = (
    PROJECT_PATH + STATIC_URL,
)

Also I am trying to get this working locally i'm not worried about getting it to work in production yet.

Author:Tyler,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/27894935/django-static-files-getting-a-404
catavaran :

You PROJECT_PATH is wrong. It points to one level up of the real project path.\n\nTry these settings:\n\nSTATIC_PATH = os.path.join(BASE_DIR, 'static')\n\nSTATICFILES_DIRS = (\n STATIC_PATH,\n)\n",
2015-01-12T04:14:37
yy