Layout for media files, with an empty stylesheet at the moment
This commit is contained in:
parent
9add66f49a
commit
9b72bb8490
|
@ -4,6 +4,7 @@ import os
|
|||
|
||||
DEBUG = True
|
||||
USE_DEBUG_TOOLBAR = True
|
||||
STATIC_SERVE = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
@ -45,17 +46,17 @@ USE_L10N = True
|
|||
|
||||
# Absolute path to the directory that holds media.
|
||||
# Example: "/home/media/media.lawrence.com/"
|
||||
MEDIA_ROOT = ''
|
||||
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||
# trailing slash if there is a path component (optional in other cases).
|
||||
# Examples: "http://media.lawrence.com", "http://example.com/media/"
|
||||
MEDIA_URL = ''
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
||||
# trailing slash.
|
||||
# Examples: "http://foo.com/media/", "/media/".
|
||||
ADMIN_MEDIA_PREFIX = '/media/'
|
||||
ADMIN_MEDIA_PREFIX = '/media/admin/'
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = '0!=(1kc6kri-ui+tmj@mr+*0bvj!(p*r0duu2n=)7@!p=pvf9n'
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="/style.css" />
|
||||
<link rel="stylesheet" href="{{ MEDIA_URL }}css/style.css" />
|
||||
<title>{% block title %}User test{% endblock %}</title>
|
||||
</head>
|
||||
|
||||
|
|
11
urls.py
11
urls.py
|
@ -1,6 +1,9 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.contrib import admin
|
||||
from django.views.generic.simple import direct_to_template
|
||||
|
||||
import settings
|
||||
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
|
@ -9,3 +12,11 @@ urlpatterns = patterns('',
|
|||
(r'^$', direct_to_template,
|
||||
{ 'template': 'index.html' }, 'index'),
|
||||
)
|
||||
|
||||
if settings.STATIC_SERVE:
|
||||
urlpatterns += patterns('',
|
||||
url(
|
||||
regex = r'^media/(?P<path>.*)$',
|
||||
view = 'django.views.static.serve',
|
||||
kwargs = {'document_root': settings.MEDIA_ROOT}),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue