Make static media play nice with the debug server. For the lovely @cz.

master
Nick Sergeant 2013-04-16 11:07:13 -04:00
parent 3b25563018
commit 632240829c
4 changed files with 57 additions and 48 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,17 +6,17 @@ $Rockwell: 'Rockwell', 'Courier Bold', Courier, Georgia, Times, 'Times New Roman
@font-face {
font-family: 'Rockwell';
src: url('/static/fonts/rockwell-standard.eot');
src: url('/static/fonts/rockwell-standard.eot?#iefix') format('embedded-opentype'),
url('/static/fonts/rockwell-standard.woff') format('woff'),
url('/static/fonts/rockwell-standard.ttf') format('truetype');
src: url('../fonts/rockwell-standard.eot');
src: url('../fonts/rockwell-standard.eot?#iefix') format('embedded-opentype'),
url('../fonts/rockwell-standard.woff') format('woff'),
url('../fonts/rockwell-standard.ttf') format('truetype');
}
@font-face {
font-family: 'Rockwell Bold Italic';
src: url('/static/fonts/rockwell-bold-italic.eot');
src: url('/static/fonts/rockwell-bold-italic.eot?#iefix') format('embedded-opentype'),
url('/static/fonts/rockwell-bold-italic.woff') format('woff'),
url('/static/fonts/rockwell-bold-italic.ttf') format('truetype');
src: url('../fonts/rockwell-bold-italic.eot');
src: url('../fonts/rockwell-bold-italic.eot?#iefix') format('embedded-opentype'),
url('../fonts/rockwell-bold-italic.woff') format('woff'),
url('../fonts/rockwell-bold-italic.ttf') format('truetype');
}
// Mixins
@ -106,7 +106,7 @@ body {
// Global
header.main {
background: #12343D url('/static/img/header-bg.gif') top left repeat-x;
background: #12343D url('../img/header-bg.gif') top left repeat-x;
border-bottom: 1px solid #DDDDDD;
height: 66px;
position: relative;
@ -120,7 +120,7 @@ header.main {
width: 939px;
div.shadey {
background: transparent url('/static/img/header-inner-bg.png') top left no-repeat;
background: transparent url('../img/header-inner-bg.png') top left no-repeat;
height: 65px;
left: -157px;
position: absolute;
@ -135,8 +135,8 @@ header.main {
z-index: 50;
input {
background: #17484F url('/static/img/search-icon.png') top left no-repeat;
background: rgba(43, 82, 93, .5) url('/static/img/search-icon.png') 8px center no-repeat;
background: #17484F url('../img/search-icon.png') top left no-repeat;
background: rgba(43, 82, 93, .5) url('../img/search-icon.png') 8px center no-repeat;
border: 1px solid #3A5E67;
color: #FFF;
font: normal 12px $Helvetica;
@ -272,7 +272,7 @@ header.main {
}
}
ul {
background: transparent url('/static/img/aside-nav-open-bottom-bg.gif') top left repeat;
background: transparent url('../img/aside-nav-open-bottom-bg.gif') top left repeat;
display: none;
left: 0;
margin: 0;
@ -305,7 +305,7 @@ header.main {
}
&.open {
a.mini-profile {
background: transparent url('/static/img/aside-nav-open-top-bg.gif') top left repeat-x;
background: transparent url('../img/aside-nav-open-top-bg.gif') top left repeat-x;
opacity: 1;
span.avatar {
@ -398,7 +398,7 @@ header.sub {
float: right;
a {
background: transparent url('/static/img/rss-icon.png') center left no-repeat;
background: transparent url('../img/rss-icon.png') center left no-repeat;
display: inline-block;
margin-right: 15px;
padding-left: 15px;
@ -526,7 +526,7 @@ section.main {
margin: 0 0 30px 15px;
h1 {
background: transparent url('/static/img/tags-icon.png') 0 0 no-repeat;
background: transparent url('../img/tags-icon.png') 0 0 no-repeat;
color: #3BAAF3;
font: bold 12px $Helvetica;
padding-bottom: 5px;
@ -594,7 +594,7 @@ section.main {
margin: 0;
li {
background: transparent url('/static/img/api-icon.png') center left no-repeat;
background: transparent url('../img/api-icon.png') center left no-repeat;
list-style-type: none;
margin: 0;
padding-left: 22px;
@ -626,13 +626,13 @@ section.main {
padding-top: 1px;
}
&.twitter {
background: transparent url('/static/img/twitter-icon.png') 4px center no-repeat;
background: transparent url('../img/twitter-icon.png') 4px center no-repeat;
}
&.pro {
background: transparent url('/static/img/upgrade-icon.png') 2px center no-repeat;
background: transparent url('../img/upgrade-icon.png') 2px center no-repeat;
}
&.groups {
background: transparent url('/static/img/groups-icon.png') 2px center no-repeat;
background: transparent url('../img/groups-icon.png') 2px center no-repeat;
}
&:first-of-type {
a {
@ -640,16 +640,16 @@ section.main {
}
}
&.blog {
background: transparent url('/static/img/blog-icon.png') 3px center no-repeat;
background: transparent url('../img/blog-icon.png') 3px center no-repeat;
}
&.roadmap {
background: transparent url('/static/img/roadmap-icon.png') 2px center no-repeat;
background: transparent url('../img/roadmap-icon.png') 2px center no-repeat;
}
}
}
}
div.linode {
background: transparent url('/static/img/linode.png') top left no-repeat;
background: transparent url('../img/linode.png') top left no-repeat;
background-size: 100%;
clear: both;
float: left;
@ -903,7 +903,7 @@ article.snipt {
}
}
a.expand, a.view-full {
background: #FFF url('/static/img/expand.png') 15px 18px no-repeat;
background: #FFF url('../img/expand.png') 15px 18px no-repeat;
border-top: 1px solid #F1F1EE;
bottom: 0;
color: #999999;
@ -933,7 +933,7 @@ article.snipt {
}
}
a.view-full {
background: #FFF url('/static/img/view-full.png') 15px 17px no-repeat;
background: #FFF url('../img/view-full.png') 15px 17px no-repeat;
}
textarea.raw, textarea.description {
display: none;
@ -985,7 +985,7 @@ article.snipt {
}
}
&:after {
background: transparent url('/static/img/snipt-drop-shadow.png') top left no-repeat;
background: transparent url('../img/snipt-drop-shadow.png') top left no-repeat;
bottom: -15px;
content: "";
display: block;
@ -1048,7 +1048,7 @@ article.snipt {
margin: 2px 0;
a {
background: rgba(128, 128, 128, .15) url('/static/img/edit-icon.png') 14px center no-repeat;
background: rgba(128, 128, 128, .15) url('../img/edit-icon.png') 14px center no-repeat;
color: #000;
display: block;
font: bold 12px $Helvetica;
@ -1076,13 +1076,13 @@ article.snipt {
}
}
&.embed {
background-image: url('/static/img/embed-icon.png');
background-image: url('../img/embed-icon.png');
}
&.copy {
background-image: url('/static/img/copy-icon.png');
background-image: url('../img/copy-icon.png');
}
&.favorite {
background-image: url('/static/img/favorite-icon.png');
background-image: url('../img/favorite-icon.png');
}
}
}
@ -1091,7 +1091,7 @@ article.snipt {
padding-top: 10px;
h2 {
background: transparent url('/static/img/snipt-tags-icon.png') 15px center no-repeat;
background: transparent url('../img/snipt-tags-icon.png') 15px center no-repeat;
color: #999999;
font: bold 12px $Helvetica;
padding: 7px 0 7px 35px;
@ -1138,7 +1138,7 @@ article.snipt {
margin: 14px 0 0 15px;
li {
background: transparent url('/static/img/calendar-icon.png') top left no-repeat;
background: transparent url('../img/calendar-icon.png') top left no-repeat;
color: #999;
display: inline;
font: normal 12px $Helvetica;
@ -1203,7 +1203,7 @@ article.snipt {
}
}
&.comments {
background: transparent url('/static/img/comments-icon.png') 0 2px no-repeat;
background: transparent url('../img/comments-icon.png') 0 2px no-repeat;
}
&.raw {
background-image: none;
@ -1256,7 +1256,7 @@ article.snipt {
}
}
a.expand {
background-image: url('/static/img/collapse.png');
background-image: url('../img/collapse.png');
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
@ -1295,7 +1295,7 @@ article.snipt {
&.favorited {
div.container {
header {
@include vertical-gradient-with-image(url('/static/img/favorited-icon.png') top right no-repeat, #FFF, #FFFAF2);
@include vertical-gradient-with-image(url('../img/favorited-icon.png') top right no-repeat, #FFF, #FFFAF2);
h1 {
a {
@ -1316,7 +1316,7 @@ article.snipt {
&.blog-post.favorited {
div.container {
header {
@include vertical-gradient-with-image(url('/static/img/favorited-icon.png') top right no-repeat, #FFF, #F0F4FC);
@include vertical-gradient-with-image(url('../img/favorited-icon.png') top right no-repeat, #FFF, #F0F4FC);
@include inset-box-shadow(0, -1px, 0, #E3E9F5);
h1 {
@ -1338,7 +1338,7 @@ article.snipt {
article.private-snipt {
div.container {
header {
@include vertical-gradient-with-image(url('/static/img/private-icon.png') top right no-repeat, #FFF, #FFFAF2);
@include vertical-gradient-with-image(url('../img/private-icon.png') top right no-repeat, #FFF, #FFFAF2);
h1 {
a {
@ -1350,7 +1350,7 @@ article.private-snipt {
&.blog-post {
div.container {
header {
@include vertical-gradient-with-image(url('/static/img/private-icon.png') top right no-repeat, #FFF, #F0F4FC);
@include vertical-gradient-with-image(url('../img/private-icon.png') top right no-repeat, #FFF, #F0F4FC);
h1 {
a {
@ -1530,7 +1530,7 @@ div.site-notice {
}
}
a.go-pro {
background: transparent url('/static/img/pro-hero-bg.png') top left repeat;
background: transparent url('../img/pro-hero-bg.png') top left repeat;
color: #797979;
display: block;
font: bold 12px $Helvetica;
@ -1834,7 +1834,7 @@ body.jobs {
}
body.pro {
div.pro-hero {
background: transparent url('/static/img/pro-hero-bg.png') top left repeat;
background: transparent url('../img/pro-hero-bg.png') top left repeat;
border-bottom: 1px solid #DDDDDD;
color: #797979;
font: normal 36px $RockwellBoldItalic;
@ -1919,7 +1919,7 @@ body.pro {
font-size: 13px;
}
div.security {
background: #FCF8E3 url('/static/img/private-icon.png') 7px -15px no-repeat;
background: #FCF8E3 url('../img/private-icon.png') 7px -15px no-repeat;
border: 1px solid #FBEED5;
color: #C09853;
display: inline-block;
@ -2236,7 +2236,7 @@ body.editing {
display: none;
}
header.fixed-save {
background: #FFF url('/static/img/header-fixed-save.gif') top left repeat;
background: #FFF url('../img/header-fixed-save.gif') top left repeat;
border-bottom: 1px solid #DDDDDD;
height: 40px;
left: 0;
@ -2358,7 +2358,7 @@ body.editing {
vertical-align: -3px;
}
&.is-private {
background: #EFEEEF url('/static/img/private-icon-edit.png') 199px center no-repeat;
background: #EFEEEF url('../img/private-icon-edit.png') 199px center no-repeat;
}
&.is-public {
background: #F2DEDE;

15
urls.py
View File

@ -1,14 +1,20 @@
from views import (homepage, lexers, pro_signup, sitemap, tags, pro_signup_complete)
from django.conf import settings
from django.conf.urls import include, patterns, url
from utils.views import SniptRegistrationView
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.http import HttpResponseRedirect
from django.contrib import admin
from snipts.api import (PublicSniptResource, PublicTagResource,
PublicUserResource, PrivateSniptResource,
PrivateFavoriteResource, PrivateUserProfileResource,
PrivateTagResource, PrivateUserResource)
from snipts.views import search
from tastypie.api import Api
from snipts.api import *
from utils.views import SniptRegistrationView
from views import (homepage, lexers, pro_signup, sitemap, tags, pro_signup_complete)
import admin as custom_admin
import os
admin.autodiscover()
@ -60,3 +66,6 @@ urlpatterns = patterns('',
url(r'^', include('snipts.urls')),
)
if settings.DEBUG:
urlpatterns = urlpatterns + static('/media/', document_root=os.path.join(settings.BASE_PATH, 'media'))