0

私はこの質問と非常によく似た問題を抱えていますが、残念ながら、どの解決策もうまくいかないようです。

基本的に、次の非常に単純なディレクトリがあります。

ulogin
 - models.py
 - tests.py
 - views.py
 - media 
   - screen.css
 - templates
   - utemplate
     - index.html

私の中で私settings.pyは次のように定義しています:

MEDIA_ROOT = '../compwebsite/ucode/ulogin/media'
MEDIA_URL = '/media/'

そして、index.html私は以下を参照しようとしていますscreen.css

<html>
<head> 
    <title>
        YAY TITLE
    </title>
    <link rel="stylesheet" href="{{ MEDIA_URL }}screen.css">
<!--and it more...-->

urls.pyは次のものを持っています:

from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static

if settings.DEBUG:
# static files (images, css, javascript, etc.)
urlpatterns += patterns('',
    (r'^media/(?P<path>.*)$', 'django.views.static.serve', {
    'document_root': settings.MEDIA_ROOT}))

私が何をしても、screen.css仕事への参照を得ることができません。このサイトの他の質問に基づいて、これを修正する方法が本当にわかりません。ありがとうございます。さらに情報が必要な場合はお知らせください。

4

1 に答える 1