خرید بک لینک

Vote count: 0

I've spent the entire day trying to figure out why the static files don't appear on the website despite being referenced correctly. My base template:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>{% block title %}Sinergia Creativa{% endblock %}</title>
        {% load staticfiles %}
        <link rel="shortcut icon" type="image/png" href="{%  static 'favicon.ico' %}"/>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
        <link href='https://fonts.googleapis.com/css?family=Satisfy' rel='stylesheet' type='text/css'/>
        <link rel="stylesheet" type="text/css" href="{% static 'publicidad/style.css' %}"/>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
        <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    </head>
<body>
    <div class="container-fluid">
        <div class="row">
            <nav class="navbar navbar-inverse">
                <div class="container-fluid">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#topNavBar">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="{% url 'publicidad:index' %}">Sinergia&nbsp;Creativa</a>
                   </div>
                   <div class="collapse navbar-collapse">
                        <ul class="nav navbar-nav">
                            <li class="">
                                <a href="#">Promociones</a>
                            </li>
                            <li class="">
                                <a href="#">Contacto</a>
                            </li>
                        </ul>
                   </div>
                </div>
            </nav>
        </div>
    </div>
    {% block body %}
    {% endblock %}
</body>
</html>

My settings.py:

import os

BASE_DIR = os.path.diame(os.path.diame(os.path.abspath(__file__)))


DEBUG = True

ALLOWED_HOSTS = []


INSTALLED_APPS = [
    'publicidad.apps.PublicidadConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

MIDDLEWARE_CLASSES = [
    'django.middleware.security.SecurityMiddleware',
    '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',
]

ROOT_URLCONF = 'sinergia_creativa.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        '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 = 'sinergia_creativa.wsgi.application'


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


STATIC_URL = '/static/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

I have another project that is configured the same way and that one works so I'm puzzled.

My main problem is that the static files aren't being loaded at all despite actually being referenced and found without issues. I've used findstatic in the manage.py shell and it found them at the correct location. I used Firebug to look at what was being referenced at it was the correct path throwing me this

<link href="/static/publicidad/style.css" type="text/css" rel="stylesheet">
Reload the site to obtain the source code of: http://localhost:800/static/publicidad/style.css

I don't know what else to do. Other project worked fine under those settings. Let me know if you need any other information from the project.

Cheers, Datkros.

asked 58 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 16 فروردين 1395 ساعت: 8:37

صفحه بندی