HEELP!! CANT LOAD THE CSS OF MY DJANGO ADMIN PAGE WHY??

24 views
Skip to first unread message

Dario Coronel

unread,
Aug 23, 2018, 3:31:08 PM8/23/18
to Django users
I follow step by step the instructions of the documentatión of django especificly the tutorial part two when i create my superuser its all ok The problem is whe i put $python runserver he work but not find the statics files and not load the styles just the view without nothing
what i have done wrong?


this is my settings.py 

"""
Django settings for mysite project.

Generated by 'django-admin startproject' using Django 2.0.8.

For more information on this file, see

For the full list of settings and their values, see
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '2)a0=!9utl%7lrjixn0s4w(_q1so-$=__iy%@$$yi+!22rqjh)'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = ['localhost', '127.0.0.1',]


# Application definition

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

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'mysite.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 = 'mysite.wsgi.application'


# Database

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


# Password validation

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',
    },
]


# Internationalization

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Europe/Istanbul'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)

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





what is the problem?

Tim Vogt (Tim Vogt)

unread,
Aug 23, 2018, 4:14:28 PM8/23/18
to Django users
try $python manage.py runserver 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/029a39f1-6538-44e7-ac92-4bd96f42866f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sclo...@nexapp.ca

unread,
Aug 23, 2018, 5:19:24 PM8/23/18
to Django users
If you are in development mode (as I assume you are since you run `python manage.py runserver`), you need to set `DEBUG=True` in your settings.py file. Otherwise Django assumes that another program is serving the static files (nginx, apache, etc) and does not need to serve them itself.
Reply all
Reply to author
Forward
0 new messages