Axel Rau
unread,Jul 6, 2017, 5:04:56 AM7/6/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Hi,
I can’t find the answer to this simple question:
Why do I get
[06/Jul/2017 09:54:20] "GET /static/css/bootstrap.min.css HTTP/1.1" 404 1676
on development server, while on production server, it works.
In production, I have
<link href=„{{ STATIC_URL }}css/bootstrap.min.css" rel="stylesheet" media="screen">
On development, I have tried this and this:
<link href=„{% static 'css/bootstrap.min.css' %}" rel="stylesheet" media="screen">
Both do not work.
Config on (pathes have been checked and are ok):
INSTALLED_APPS = (
. . .
‚django.contrib.staticfiles',
. . .
)
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',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': False,
'DIRS': [os.path.join(BASE_DIR, 'templates'),],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.request',
'django.template.context_processors.static',
'django.contrib.messages.context_processors.messages',
],
# start - please add only if APP_DIRS is False
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
],
# end - please add only if APP_DIRS is False
'debug': True
}
}
]
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, „static")
##print(‚STATIC_ROOT = {}'.format(os.path.abspath(STATIC_ROOT)))
In production config, I have both staticfiles app and static template.context_processors disabled.
Thanks, Axel
---
PGP-Key:29E99DD6 ☀ computing @ chaos claudius