Richard Jones committed b88b01c

cleaning up static / media url and file stuff

Comments (0)

Files changed (12)


 	padding: 0px;
 	font: 13px sans-serif;
 	color: #212121;
-	background: #e6ce84 url(img01.jpg) repeat-x left top;
+	background: #ccc;
 h1 {


 class Rating(models.Model):
     entry = models.ForeignKey(Entry)
     user = models.ForeignKey(User)
-    fun = models.PositiveIntegerField(choices=RATING_CHOICES)
-    innovation = models.PositiveIntegerField(choices=RATING_CHOICES)
-    production = models.PositiveIntegerField(choices=RATING_CHOICES)
+    fun = models.PositiveIntegerField(choices=RATING_CHOICES, default=3)
+    innovation = models.PositiveIntegerField(choices=RATING_CHOICES, default=3)
+    production = models.PositiveIntegerField(choices=RATING_CHOICES, default=3)
     nonworking = models.BooleanField()
     disqualify = models.BooleanField()
     comment = models.TextField()


 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
-    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> 
-    <link rel="stylesheet" href="" type="text/css">
+    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
+    <link rel="stylesheet" href="{{ STATIC_URL }}challenge.css" type="text/css">
     <link rel="alternate" type="application/rss+xml"
        title="PyWeek Diaries RSS feed"
-       href="">
-    <script src="" type="text/javascript"></script>
-    <script src="" type="text/javascript"></script>
+       href="{{ MEDIA_URL }}rss/diaries.rss">
+       <script src="{{ STATIC_URL }}js/challenge.js" type="text/javascript"></script>
+       <script src="{{ STATIC_URL }}js/jquery.min.js" type="text/javascript"></script>
     {% block links %}
     {% endblock %}
     <title>{% block title %}{% endblock %}</title>
 <div id="header">
  <div id="logo">
-    <A href="/"><IMG border="0" src=""></A></span>
+     <a href="/"><img border="0" src="{{ STATIC_URL }}pyweek.png"></a></span>
  <div id="menu">
   <ul id="cssdropdown">
   <ul id="cssdropdown">
     <li class="headlink">
          {% if not latest.isCompStarted %}
             <A href="/{{ latest.number }}/">Next Challenge</A>
           {% for one in all reversed %}
              <li><a title="{{ one.title|escape }}" href="/{{ one.number }}/">{{ one.start|date:"F Y" }}</a></li>
           {% endfor %}
-          <li><a href="">June 2006 (mini)</a></li>
+          <li><a href="{{ STATIC_URL }}pygame.draw-0606.html">June 2006 (mini)</a></li>
           <li><a href="">August 2005</a></li>
 <div id="footer">
 Contact &lt;; with any enquiries.
-Site <A href="">conditions of use</A>.
+Site <A href="{{ STATIC_URL }}conditions.html">conditions of use</A>.
 Hosting thanks to <A href=""></A>.<BR>
 Site developed in <A href="">Python</A>
 using <A href="">Django</A> and


 <dd>The percentage of participants (users) who rated this game and couldn't get the game to run.</dd>
-<dd>The percentage of total participants (users from finishing entries) who thought the entry broke the challenge <a href="">rules</a>. </dd>
+<dd>The percentage of total participants (users from finishing entries) who thought the entry broke the challenge <a href="{{ STATIC_URL }}rules.html">rules</a>. </dd>


               <input type="radio" name="award" value="{{}}" />
-              <img src="{{award.content}}" /><br/>
+                <img src="{{ MEDIA_URL }}dl/{{award.content}}" /><br/>


   {% for entryaward in received_awards %}
     <div class="award">
       <a href="/a/{{}}">
-        <img src="{{entryaward.award.content}}">
+          <img src="{{ MEDIA_URL }}dl/{{entryaward.award.content}}">
   {% for award in given_awards %}
     <div class="award">
       <a href="/a/{{}}">
-        <img src="{{award.content}}">
+          <img src="{{ MEDIA_URL }}dl/{{award.content}}">


 <tr><td class="form-label"><label for="id_username">Username:</label></td><td>{{ form.username }}</td></tr>
 <tr><td class="form-label"><label for="id_password">Password:</label></td><td>{{ form.password }}</td></tr>
-<p class="form-help">By logging in you are agreeing to the PyWeek <a href="">conditions of use</a>.</p>
+        <p class="form-help">By logging in you are agreeing to the PyWeek <a href="{{ STATIC_URL }}conditions.html">conditions of use</a>.</p>
 <input type="submit" value="login">


 {% endif %}
 <p>By signing up to this challenge, you agree to its
-<a href="">conditions of use</a>.</p>
+<a href="{{ STATIC_URL }}conditions.html">conditions of use</a>.</p>
 <legend>Registration Form</legend>


     (r'^all_awards/$', 'view_all_awards'),
-urlpatterns += patterns('django.views.static',
-    (r'^js/(?P<path>.*)$', 'serve',
-        {'document_root': '/home/pyweek/lib/pyweek/challenge/media/js'}),
-    (r'(^favicon\.ico$)', 'serve',
-        {'document_root': '/home/pyweek/lib/pyweek/challenge/media/'}),


-# Absolute path to the directory that holds media.
-MEDIA_ROOT = '/home/pyweek/media/dl/'
+# Absolute path to the directory that holds uploaded files and its URL
+MEDIA_ROOT = ''     # must be set per deployment
+MEDIA_URL = '/media/'
-# URL that handles the media served from MEDIA_ROOT.
+# Absolute path to the directory that holds static files and its URL
+STATIC_ROOT = ''   # must be set per deployment
+STATIC_URL = '/static/'
 # Path to the two RSS files generated by the challenge diary RSS generation
 # code
+    "django.core.context_processors.static",
+    "",
 #    "django.core.context_processors.i18n",
-STATIC_ROOT = '/home/pyweek/static/'
 from django.conf.urls.defaults import *
 from django.contrib import admin
+from django.contrib.staticfiles.urls import staticfiles_urlpatterns
+from django.conf import settings
 urlpatterns = patterns('',
      url(r'^admin/', include(,
      (r'', include('pyweek.challenge.urls')),
+urlpatterns += staticfiles_urlpatterns()
+if settings.DEBUG:
+    urlpatterns += patterns('',
+        url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
+            'document_root': settings.MEDIA_ROOT,
+        }),
+   )