mercredi 29 avril 2015

Django 1.8 static files doesnt work

Im using the 1.8 version of Django and my CSS, JS or images are not working, i really dont know why, my project folder is like

Project
    Jetint
      Static
        CSS

My settings:

    DEBUG = True

ALLOWED_HOSTS = []


# Application definition

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

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 'jetint.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['jetint/templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'jetint.wsgi.application'


# Database
# http://ift.tt/1EF8GkO

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'bd',
        'USER': 'bd',
        'PASSWORD': 'xxxx',
        'HOST': '',
        'PORT': '',
        'ATOMIC_REQUESTS': True
    }
}

TEMPLATE_DIRS = (BASE_DIR, 'jetint/templates')

# Internationalization
# http://ift.tt/1CMZi8Y

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# http://ift.tt/1EF8GkR

STATIC_URL = '/static/'
STATIC_ROOT = (
    os.path.join(BASE_DIR, '/static/'),
)

STATICFILES_DIRS = (STATIC_ROOT,)

and my base.html

<!DOCTYPE html>
<html lang="en">
<head>
<title> - {% block title-section%}{% endblock %}</title>
<meta charset="utf-8">
<meta name = "format-detection" content = "telephone=no" />
{# <link rel="icon" href="{{ STATIC_URL }}images/favicon.ico"> #}
{# <link rel="shortcut icon" href="{{ STATIC_URL }}images/favicon.ico" /> #}
{% load staticfiles %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/camera.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/stuck.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/style.css">

but nothing works, css, js files, or images. please help?

Aucun commentaire:

Enregistrer un commentaire