Форум программистов, компьютерный форум, киберфорум
Python: Django
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.88/58: Рейтинг темы: голосов - 58, средняя оценка - 4.88
0 / 0 / 2
Регистрация: 13.03.2012
Сообщений: 27

Подключение CSS в Django

17.11.2012, 19:57. Показов 12487. Ответов 12
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Django не отображает таблицы стилей, вот код:
views.py
Python
1
2
3
4
from django.shortcuts import render_to_response
 
def translit(request):
    return render_to_response('translit.html')
urls.py
Python
1
2
3
4
5
6
7
8
9
from django.conf.urls import patterns, include, url
from django.conf import settings
from translit.views import translit, dotranslit
 
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
 
urlpatterns = patterns('',(r'^translit/$', translit),)
settings.py
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Django settings for translit project.
from os.path import join, abspath, normpath, dirname
ProjectDir = dirname(abspath(__file__))
 
def tpl_dir(src):
    return normpath(join(ProjectDir, src)).replace('\\', '/')
 
DEBUG = True
TEMPLATE_DEBUG = DEBUG
 
ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)
 
MANAGERS = ADMINS
 
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}
 
# Local time zone for this installation. Choices can be found here:
# [url]http://en.wikipedia.org/wiki/List_of_tz_zones_by_name[/url]
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Chicago'
 
# Language code for this installation. All choices can be found here:
# [url]http://www.i18nguy.com/unicode/language-identifiers.html[/url]
LANGUAGE_CODE = 'en-us'
 
SITE_ID = 1
 
USE_I18N = True
 
USE_L10N = True
 
USE_TZ = True
 
MEDIA_ROOT = ''
 
MEDIA_URL = ''
 
STATIC_ROOT = tpl_dir('stats')
 
STATIC_URL = '/static/'
 
 
STATICFILES_DIRS = (tpl_dir('stats'), )
 
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'django.contrib.staticfiles',
)
 
SECRET_KEY = '=%ugzer(1^i#u1bfdkp&*a(hsa14gga(%+f1lhii@4xc8_t+lm'
 
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
 
)
 
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
 )
 
ROOT_URLCONF = 'translit.urls'
 
WSGI_APPLICATION = 'translit.wsgi.application'
 
 
TEMPLATE_DIRS = (tpl_dir('templates'),)
 
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
)
 
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}
translit.html (шаблон)
HTML5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
<head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <meta name="author" content="Eduard" />
    <link href="{{STATIC_URL}}css/style.css" rel="stylesheet" type="text/css" media="screen" />
 
    <title>TranslitIt</title>
        
</head>
 
<body>
    <div id="wrapper">
        <div id="logo"></div>
        <form name="tranc" id="form" action="/do/" method="get" target="_self">
            <label><p>Введите ваш текст на русском:</p>
            <p><input name="text" id="text" type="text" size="50"/></p></label>
            <p><input name="submit" id="button" type="submit" value="Перевести"/></p>
        </form>
        
        
    </div>
 
</body>
</html>
Таблица стилей находится в папке stats, но ничего не отображается. Помогите разобраться, в чем ошибка?
0
Programming
Эксперт
39485 / 9562 / 3019
Регистрация: 12.04.2006
Сообщений: 41,671
Блог
17.11.2012, 19:57
Ответы с готовыми решениями:

CSS для Django
Добрый день. По сути очень легкий, но я с ним справиться не смог - подключить CSS к Django. Информацию брал на западных источниках (а там...

Django Failed to load css
У меня установлен Geonode (геопортал), в основе которой Django. Доступен по ссылке http://armsis.cas.am/ Какое-то время все работало...

Django работа с JS, CSS и фото (static)
начал учить django, пишу на нем сайт, есть готовая верстка, нужно переделать подключение всех фото, js и css в файле templates/index.html...

12
 Аватар для soon
2554 / 1319 / 178
Регистрация: 09.05.2011
Сообщений: 3,086
Записей в блоге: 1
17.11.2012, 22:00
derden93, уже не помню, как настраивал, но в шаблоне такие строки
HTML5
1
2
3
4
{% load static %}
{% get_static_prefix as STATIC_PREFIX %}
 
<link rel="stylesheet" href="{{ STATIC_PREFIX }}css/style.css" type="text/css" media="all" charset="utf-8">
0
0 / 0 / 2
Регистрация: 13.03.2012
Сообщений: 27
17.11.2012, 22:09  [ТС]
Цитата Сообщение от soon Посмотреть сообщение
derden93, уже не помню, как настраивал, но в шаблоне такие строки
HTML5
1
2
3
4
{% load static %}
{% get_static_prefix as STATIC_PREFIX %}
 
<link rel="stylesheet" href="{{ STATIC_PREFIX }}css/style.css" type="text/css" media="all" charset="utf-8">
Не работает(
0
 Аватар для soon
2554 / 1319 / 178
Регистрация: 09.05.2011
Сообщений: 3,086
Записей в блоге: 1
17.11.2012, 22:20
Попробуйте в TEMPLATE_CONTEXT_PROCESSORS добавить 'django.core.context_processors.static'
0
0 / 0 / 2
Регистрация: 13.03.2012
Сообщений: 27
17.11.2012, 22:55  [ТС]
Цитата Сообщение от soon Посмотреть сообщение
Попробуйте в TEMPLATE_CONTEXT_PROCESSORS добавить 'django.core.context_processors.static'
TEMPLATE_CONTEXT_PROCESSORS его самому нужно прописать? В settings этого пункта нет
0
 Аватар для soon
2554 / 1319 / 178
Регистрация: 09.05.2011
Сообщений: 3,086
Записей в блоге: 1
18.11.2012, 07:31
derden93, Да.
0
0 / 0 / 2
Регистрация: 13.03.2012
Сообщений: 27
18.11.2012, 13:59  [ТС]
Цитата Сообщение от soon Посмотреть сообщение
derden93, Да.
Нет, не выходит. Вы не могли бы скинуть пример настроек settings?
0
 Аватар для soon
2554 / 1319 / 178
Регистрация: 09.05.2011
Сообщений: 3,086
Записей в блоге: 1
18.11.2012, 19:05
https://docs.djangoproject.com... aticfiles/
Кликните здесь для просмотра всего текста
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# Django settings for project.
import os.path
from django_settings.settings import *
 
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
 
# DEBUG = settings.DEBUG
 
TEMPLATE_DEBUG = DEBUG
 
# ADMINS = settings.ADMINS
 
# MANAGERS = settings.MANAGERS
 
# DATABASES = settings.DATABASES
 
# SECRET_KEY = settings.SECRET_KEY
 
LOGIN_URL = '/login/'
 
LOGIN_REDIRECT_URL = '/'
 
# Local time zone for this installation. Choices can be found here:
# [url]http://en.wikipedia.org/wiki/List_of_tz_zones_by_name[/url]
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Asia/Yekaterinburg'
 
# Language code for this installation. All choices can be found here:
# [url]http://www.i18nguy.com/unicode/language-identifiers.html[/url]
LANGUAGE_CODE = 'ru-RU'
 
SITE_ID = 1
 
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
 
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
 
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
 
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
 
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
 
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
 
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
 
# Additional locations of static files
STATICFILES_DIRS = (
    os.path.join(PROJECT_PATH, 'static'),
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)
 
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
#    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
 
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)
 
TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.request',
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'django.core.context_processors.tz',
    'django.contrib.messages.context_processors.messages',
)
 
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'berfmk.middleware.exception.ExceptionLoggingMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
 
ROOT_URLCONF = 'berfmk.urls'
 
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'berfmk.wsgi.application'
 
TEMPLATE_DIRS = (
    # '/home/soon/Src/Django/berfmk/art/templates',
    os.path.join(os.path.dirname(__file__), 'templates').replace('\\', '/'),
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)
 
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.comments',
    # 'django.contrib.markup',
    'django.contrib.humanize',
    'django.contrib.formtools',
    'south',
    'accounts',
    'news',
    'forum',
    #'art',
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)
 
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
 
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See [url]http://docs.djangoproject.com/en/dev/topics/logging[/url] for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}
0
0 / 0 / 2
Регистрация: 13.03.2012
Сообщений: 27
19.11.2012, 18:59  [ТС]
Цитата Сообщение от soon Посмотреть сообщение
https://docs.djangoproject.com... aticfiles/
Кликните здесь для просмотра всего текста
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# Django settings for project.
import os.path
from django_settings.settings import *
 
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
 
# DEBUG = settings.DEBUG
 
TEMPLATE_DEBUG = DEBUG
 
# ADMINS = settings.ADMINS
 
# MANAGERS = settings.MANAGERS
 
# DATABASES = settings.DATABASES
 
# SECRET_KEY = settings.SECRET_KEY
 
LOGIN_URL = '/login/'
 
LOGIN_REDIRECT_URL = '/'
 
# Local time zone for this installation. Choices can be found here:
# [url]http://en.wikipedia.org/wiki/List_of_tz_zones_by_name[/url]
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Asia/Yekaterinburg'
 
# Language code for this installation. All choices can be found here:
# [url]http://www.i18nguy.com/unicode/language-identifiers.html[/url]
LANGUAGE_CODE = 'ru-RU'
 
SITE_ID = 1
 
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
 
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
 
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
 
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
 
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
 
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
 
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
 
# Additional locations of static files
STATICFILES_DIRS = (
    os.path.join(PROJECT_PATH, 'static'),
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)
 
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
#    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
 
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)
 
TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.request',
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'django.core.context_processors.tz',
    'django.contrib.messages.context_processors.messages',
)
 
MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'berfmk.middleware.exception.ExceptionLoggingMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
 
ROOT_URLCONF = 'berfmk.urls'
 
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'berfmk.wsgi.application'
 
TEMPLATE_DIRS = (
    # '/home/soon/Src/Django/berfmk/art/templates',
    os.path.join(os.path.dirname(__file__), 'templates').replace('\\', '/'),
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)
 
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.comments',
    # 'django.contrib.markup',
    'django.contrib.humanize',
    'django.contrib.formtools',
    'south',
    'accounts',
    'news',
    'forum',
    #'art',
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)
 
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
 
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See [url]http://docs.djangoproject.com/en/dev/topics/logging[/url] for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}
Не работает, понятия не имею в чем дело
0
 Аватар для ilnurgi
141 / 141 / 38
Регистрация: 20.02.2012
Сообщений: 597
19.11.2012, 21:00
derden93,
как вы юзаете джангу?
через встроенный сервер или на каком то серваке запускаете? типа nginx
0
0 / 0 / 2
Регистрация: 13.03.2012
Сообщений: 27
19.11.2012, 21:20  [ТС]
Цитата Сообщение от ilnurgi Посмотреть сообщение
derden93,
как вы юзаете джангу?
через встроенный сервер или на каком то серваке запускаете? типа nginx
Встроенный devserver
0
 Аватар для ilnurgi
141 / 141 / 38
Регистрация: 20.02.2012
Сообщений: 597
19.11.2012, 21:56
итак.
python 2.7.3, django 1.4

settings.py
Python
1
2
3
4
5
6
7
8
9
10
11
...
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    'C:/Python27/Scripts/tests/static', # тут путь к папке, в котором лежат css файлы
)
...
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/' # папка, через которую обратиться в шаблонах к папке статика
index.html
HTML5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
 
<head>
<!-- используем просто префикс /static/-->
    <link href="/static/css.css" rel="stylesheet" type="text/css" media="screen" />
 
    <title>TranslitIt</title>
        
</head>
 
<body>
    привет
 
</body>
</html>
0
2 / 2 / 3
Регистрация: 18.11.2012
Сообщений: 15
20.11.2012, 20:42
python manage.py runserver
и потом попробуйте скачать файл статики посмотрите какой идет запрос на сервер в терминале и какой ответ там и ошибку напишет если есть
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
inter-admin
Эксперт
29715 / 6470 / 2152
Регистрация: 06.03.2009
Сообщений: 28,500
Блог
20.11.2012, 20:42
Помогаю со студенческими работами здесь

Почему не обновляются стили css в django
.vniz { margin-top:0px; } я давно удалил но он все еще есть. .vnizz { margin-top:90px; }а при изменении значения...

Подключение Js к Django
Имею такую структуру проекта Изучаю Django, понял основные нюансы создания сайта. Решил заняться версткой но без js я и половины...

Какая то ошибка с CSS стилями в штмл в Django
Тут вроде не ошибка,но я хз что это.Подключил ксс стили к html шаблону в django апликейшене,все что написал в ксс сохранилось и не...

Django не находит css файлы ,что делать?
Я в шаблонизаторе Django к html коду подключил css и js файлы запускаю Django проект , в консоли мне выдаётся ,что css и js файлы не...

Подключение django к имеющейся БД
Добрый день! Изучаю django. Имею готовую БД (на mssql server), на основе которой хочу попрактиковаться с этим фреймворком. Таблицы БД...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
13
Ответ Создать тему
Новые блоги и статьи
Модель ЗдрввоСохранения 7: больше работников, больше ресурсов.
anaschu 08.04.2026
работников и заданий может быть сколько угодно, но настроено всё так, что используется пока что только 20% kYBz3eJf3jQ
Дальние перспективы сервера - слоя сети с космологическим дизайном интефейса карты и логики.
Hrethgir 07.04.2026
Дальнейшее ближайшее планирование вывело к размышлениям над дальними перспективами. И вот тут может быть даже будут нужны оценки специалистов, так как в дальних перспективах всё может очень сильно. . .
Горе от ума
kumehtar 07.04.2026
Эта мне ментальная установка, что вот прямо сейчас, мол, мне для полного счастья не хватает (нужное вписать), и когда я этого достигну - тогда и полный кайф. Одна из самых сильных ловушек на пути. . . .
Использование значений реквизитов справочника в документе, с определенными условиями и правами
Maks 07.04.2026
1. Контроль срока действия договора Алгоритм из решения ниже реализован на примере нетипового документа "ЗаявкаНаРаботу", разработанного в конфигурации КА2. Задача: уведомлять пользователя, если. . .
Доступность команды формы по условию
Maks 07.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "СписаниеМатериалов", разработанного в конфигурации КА2. Задача: сделать доступной кнопку (команда формы "ЗавершитьСписание") при. . .
Уведомление о неверно выбранном значении справочника
Maks 06.04.2026
Алгоритм из решения ниже реализован на примере нетипового документа "НарядПутевка", разработанного в конфигурации КА2. Задача: уведомлять пользователя, если в документе выбран неверный склад. . .
Установка Qt Creator для C и C++: ставим среду, CMake и MinGW без фреймворка Qt
8Observer8 05.04.2026
Среду разработки Qt Creator можно установить без фреймворка Qt. Есть отдельный репозиторий для этой среды: https:/ / github. com/ qt-creator/ qt-creator, где можно скачать установщик, на вкладке Releases:. . .
AkelPad-скрипты, структуры, и немного лирики..
testuser2 05.04.2026
Такая программа, как AkelPad существует уже давно, и также давно существуют скрипты под нее. Тем не менее, прога живет, периодически что-то не спеша дополняется, улучшается. Что меня в первую очередь. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru