Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Setup modern static files handling.

  • Loading branch information...
commit c5b01e7b0b15fcdd2de49687f97f06b516d7d17d 1 parent daf3ed0
@aaugustin aaugustin authored
Showing with 19 additions and 32 deletions.
  1. +1 −1  .gitignore
  2. +0 −7 django_docs/urls.py
  3. +7 −6 django_www/settings.py
  4. +0 −7 django_www/urls.py
  5. +2 −2 docs/management/commands/update_docs.py
  6. +3 −3 docs/templates/docs/doc.html
  7. +2 −2 docs/templates/docs/index.html
  8. 0  {media → static}/css/admin.css
  9. 0  {media → static}/css/base.css
  10. 0  {media → static}/css/community.css
  11. 0  {media → static}/css/docs/docs.css
  12. 0  {media → static}/css/docs/index.css
  13. 0  {media → static}/css/documentation.css
  14. 0  {media → static}/css/download.css
  15. 0  {media → static}/css/homepage.css
  16. 0  {media → static}/css/print.css
  17. 0  {media → static}/css/pygments.css
  18. 0  {media → static}/css/weblog.css
  19. 0  {media → static}/favicon.ico
  20. 0  {media → static}/img/badges/djangodonated126x54.gif
  21. 0  {media → static}/img/badges/djangodonated126x54_grey.png
  22. 0  {media → static}/img/badges/djangojoint107x25.gif
  23. 0  {media → static}/img/badges/djangojoint107x25_grey.gif
  24. 0  {media → static}/img/badges/djangomade124x25.gif
  25. 0  {media → static}/img/badges/djangomade124x25_grey.gif
  26. 0  {media → static}/img/badges/djangopowered126x54.gif
  27. 0  {media → static}/img/badges/djangopowered126x54_grey.gif
  28. 0  {media → static}/img/badges/djangoproject120x24.gif
  29. 0  {media → static}/img/badges/djangoproject120x25.gif
  30. 0  {media → static}/img/badges/djangoproject120x25_grey.gif
  31. 0  {media → static}/img/badges/djangosite100x25.gif
  32. 0  {media → static}/img/badges/djangosite100x25_grey.gif
  33. 0  {media → static}/img/badges/djangosite124x25.gif
  34. 0  {media → static}/img/badges/djangosite80x15.gif
  35. 0  {media → static}/img/badges/djangosite80x15_grey.gif
  36. 0  {media → static}/img/badges/djangosponsor113x25.gif
  37. 0  {media → static}/img/badges/djangosponsor113x25_grey.gif
  38. 0  {media → static}/img/badges/djangowish126x70.gif
  39. 0  {media → static}/img/badges/djangowish126x70_grey.gif
  40. 0  {media → static}/img/desktops/desktop-43_t.jpg
  41. 0  {media → static}/img/desktops/desktop-wide_t.jpg
  42. 0  {media → static}/img/desktops/djangodesktop-1024x768.jpg
  43. 0  {media → static}/img/desktops/djangodesktop-1152x864.jpg
  44. 0  {media → static}/img/desktops/djangodesktop-1280x1024.jpg
  45. 0  {media → static}/img/desktops/djangodesktop-1600x1200.jpg
  46. 0  {media → static}/img/desktops/djangodesktop-1680x1050.jpg
  47. 0  {media → static}/img/desktops/djangodesktop-800x600.jpg
  48. 0  {media → static}/img/doc/icons/docicons-behindscenes.gif
  49. 0  {media → static}/img/doc/icons/docicons-note.gif
  50. 0  {media → static}/img/doc/icons/docicons-philosophy.gif
  51. 0  {media → static}/img/logos/django-logo-negative.eps
  52. 0  {media → static}/img/logos/django-logo-negative.png
  53. 0  {media → static}/img/logos/django-logo-negative.svg
  54. 0  {media → static}/img/logos/django-logo-positive.eps
  55. 0  {media → static}/img/logos/django-logo-positive.png
  56. 0  {media → static}/img/logos/django-logo-positive.svg
  57. 0  {media → static}/img/site/arrow-head-left.gif
  58. 0  {media → static}/img/site/bbd_bg.gif
  59. 0  {media → static}/img/site/bbd_blogroll.gif
  60. 0  {media → static}/img/site/bbd_code.gif
  61. 0  {media → static}/img/site/bbd_community.gif
  62. 0  {media → static}/img/site/bbd_documentation.gif
  63. 0  {media → static}/img/site/bbd_download.gif
  64. 0  {media → static}/img/site/bbd_homepage.gif
  65. 0  {media → static}/img/site/bbd_overview.gif
  66. 0  {media → static}/img/site/bbd_weblog.gif
  67. 0  {media → static}/img/site/bbdsm_bg.gif
  68. 0  {media → static}/img/site/bbdsm_bg.gif.1
  69. 0  {media → static}/img/site/djangoapi-logo.gif
  70. 0  {media → static}/img/site/download_bg-left.gif
  71. 0  {media → static}/img/site/download_bg-right.gif
  72. 0  {media → static}/img/site/hdr_logo.gif
  73. 0  {media → static}/img/site/hdr_meetdjango.gif
  74. 0  {media → static}/img/site/invisible.gif
  75. 0  {media → static}/img/site/mt.png
  76. 0  {media → static}/img/site/nav_bg.gif
  77. 0  {media → static}/img/site/screencast-back.gif
  78. 0  {media → static}/img/site/screencast-next.gif
  79. 0  {media → static}/img/site/somerights20.png
  80. +3 −3 templates/base.html
  81. +1 −1  templates/base_code.html
View
2  .gitignore
@@ -1,5 +1,5 @@
*.pyc
*.db
local_settings.py
-media/docs
+static_root
src/
View
7 django_docs/urls.py
@@ -51,10 +51,3 @@
name = 'document-detail',
),
)
-
-if settings.DEBUG:
- urlpatterns += patterns('',
- url(r'^media/(?P<path>.*)$',
- 'django.views.static.serve',
- {'document_root': settings.MEDIA_ROOT}),
- )
View
13 django_www/settings.py
@@ -40,21 +40,21 @@
USE_I18N = False
USE_L10N = False
-TEMPLATE_DIRS = [BASE.parent.child('templates')]
MEDIA_ROOT = BASE.parent.child('media')
+MEDIA_URL = '/m/'
+TEMPLATE_DIRS = [BASE.parent.child('templates')]
+STATICFILES_DIRS = [BASE.parent.child('static')]
+STATIC_ROOT = BASE.parent.child('static_root')
+STATIC_URL = '/s/'
if PRODUCTION:
DEBUG = False
PREPEND_WWW = True
CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
- MEDIA_URL = "https://www.djangoproject.com/m/"
- ADMIN_MEDIA_PREFIX = "https://www.djangoproject.com/m/admin/"
else:
DEBUG = True
PREPEND_WWW = False
CACHE_BACKEND = "dummy:///"
- MEDIA_URL = "/media/"
- ADMIN_MEDIA_PREFIX = '/admin_media/'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
SITE_ID = 1
@@ -70,6 +70,7 @@
'django.contrib.messages',
'django.contrib.redirects',
'django.contrib.sessions',
+ 'django.contrib.staticfiles',
'django.contrib.sitemaps',
'django_push.subscriber',
'blog',
@@ -113,7 +114,7 @@
"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_website.context_processors.recent_release",
"django.contrib.messages.context_processors.messages",
]
View
7 django_www/urls.py
@@ -63,10 +63,3 @@
url(r'^svntogit/', include('svntogit.urls')),
url(r'', include('legacy.urls')),
)
-
-if not settings.PRODUCTION:
- urlpatterns += patterns("django.views",
- url(r"^media/(?P<path>.*)", "static.serve", {
- "document_root": settings.MEDIA_ROOT,
- }),
- )
View
4 docs/management/commands/update_docs.py
@@ -84,11 +84,11 @@ def handle_noargs(self, **kwargs):
#
# Create a zip file of the HTML build for offline reading.
- # This gets moved into MEDIA_ROOT for downloading.
+ # This gets moved into STATIC_ROOT for downloading.
#
html_build_dir = destdir.child('_build', 'html')
zipfile_name = 'django-docs-%s-%s.zip' % (release.version, release.lang)
- zipfile_path = Path(settings.MEDIA_ROOT).child('docs', zipfile_name)
+ zipfile_path = Path(settings.STATIC_ROOT).child('docs', zipfile_name)
if not zipfile_path.parent.exists():
zipfile_path.parent.mkdir(parents=True)
if verbosity >= 2:
View
6 docs/templates/docs/doc.html
@@ -4,8 +4,8 @@
{% block extrahead %}
{{ block.super }}
- <link rel="stylesheet" href="{{ MEDIA_URL }}css/docs/docs.css" type="text/css" />
- <link rel="stylesheet" href="{{ MEDIA_URL }}css/pygments.css" type="text/css" />
+ <link rel="stylesheet" href="{{ STATIC_URL }}css/docs/docs.css" type="text/css" />
+ <link rel="stylesheet" href="{{ STATIC_URL }}css/pygments.css" type="text/css" />
{% endblock %}
{% block billboard %}
@@ -114,7 +114,7 @@ <h2 id="comments">Questions/Feedback</h2>
<h2>Download:</h2>
<p>
Offline ({% if version == "dev" %}development version{% else %}Django {{ version }}{% endif %}):
- <a href="{{ MEDIA_URL }}docs/django-docs-{{ version }}-{{ lang }}.zip">HTML</a> |
+ <a href="{{ STATIC_URL }}docs/django-docs-{{ version }}-{{ lang }}.zip">HTML</a> |
<a href="http://media.readthedocs.org/pdf/django/{{ rtd_version }}/django.pdf">PDF</a> |
<a href="http://media.readthedocs.org/epub/django/{{ rtd_version }}/django.epub">ePub</a>
<br>
View
4 docs/templates/docs/index.html
@@ -2,7 +2,7 @@
{% block extrahead %}
{{ block.super }}
- <link rel="stylesheet" href="{{ MEDIA_URL }}css/docs/index.css" type="text/css" charset="utf-8">
+ <link rel="stylesheet" href="{{ STATIC_URL }}css/docs/index.css" type="text/css" charset="utf-8">
{% endblock %}
-{% block toc-wrapper %}{% endblock %}
+{% block toc-wrapper %}{% endblock %}
View
0  media/css/admin.css → static/css/admin.css
File renamed without changes
View
0  media/css/base.css → static/css/base.css
File renamed without changes
View
0  media/css/community.css → static/css/community.css
File renamed without changes
View
0  media/css/docs/docs.css → static/css/docs/docs.css
File renamed without changes
View
0  media/css/docs/index.css → static/css/docs/index.css
File renamed without changes
View
0  media/css/documentation.css → static/css/documentation.css
File renamed without changes
View
0  media/css/download.css → static/css/download.css
File renamed without changes
View
0  media/css/homepage.css → static/css/homepage.css
File renamed without changes
View
0  media/css/print.css → static/css/print.css
File renamed without changes
View
0  media/css/pygments.css → static/css/pygments.css
File renamed without changes
View
0  media/css/weblog.css → static/css/weblog.css
File renamed without changes
View
0  media/favicon.ico → static/favicon.ico
File renamed without changes
View
0  media/img/badges/djangodonated126x54.gif → static/img/badges/djangodonated126x54.gif
File renamed without changes
View
0  ...a/img/badges/djangodonated126x54_grey.png → ...c/img/badges/djangodonated126x54_grey.png
File renamed without changes
View
0  media/img/badges/djangojoint107x25.gif → static/img/badges/djangojoint107x25.gif
File renamed without changes
View
0  media/img/badges/djangojoint107x25_grey.gif → static/img/badges/djangojoint107x25_grey.gif
File renamed without changes
View
0  media/img/badges/djangomade124x25.gif → static/img/badges/djangomade124x25.gif
File renamed without changes
View
0  media/img/badges/djangomade124x25_grey.gif → static/img/badges/djangomade124x25_grey.gif
File renamed without changes
View
0  media/img/badges/djangopowered126x54.gif → static/img/badges/djangopowered126x54.gif
File renamed without changes
View
0  ...a/img/badges/djangopowered126x54_grey.gif → ...c/img/badges/djangopowered126x54_grey.gif
File renamed without changes
View
0  media/img/badges/djangoproject120x24.gif → static/img/badges/djangoproject120x24.gif
File renamed without changes
View
0  media/img/badges/djangoproject120x25.gif → static/img/badges/djangoproject120x25.gif
File renamed without changes
View
0  ...a/img/badges/djangoproject120x25_grey.gif → ...c/img/badges/djangoproject120x25_grey.gif
File renamed without changes
View
0  media/img/badges/djangosite100x25.gif → static/img/badges/djangosite100x25.gif
File renamed without changes
View
0  media/img/badges/djangosite100x25_grey.gif → static/img/badges/djangosite100x25_grey.gif
File renamed without changes
View
0  media/img/badges/djangosite124x25.gif → static/img/badges/djangosite124x25.gif
File renamed without changes
View
0  media/img/badges/djangosite80x15.gif → static/img/badges/djangosite80x15.gif
File renamed without changes
View
0  media/img/badges/djangosite80x15_grey.gif → static/img/badges/djangosite80x15_grey.gif
File renamed without changes
View
0  media/img/badges/djangosponsor113x25.gif → static/img/badges/djangosponsor113x25.gif
File renamed without changes
View
0  ...a/img/badges/djangosponsor113x25_grey.gif → ...c/img/badges/djangosponsor113x25_grey.gif
File renamed without changes
View
0  media/img/badges/djangowish126x70.gif → static/img/badges/djangowish126x70.gif
File renamed without changes
View
0  media/img/badges/djangowish126x70_grey.gif → static/img/badges/djangowish126x70_grey.gif
File renamed without changes
View
0  media/img/desktops/desktop-43_t.jpg → static/img/desktops/desktop-43_t.jpg
File renamed without changes
View
0  media/img/desktops/desktop-wide_t.jpg → static/img/desktops/desktop-wide_t.jpg
File renamed without changes
View
0  ...a/img/desktops/djangodesktop-1024x768.jpg → ...c/img/desktops/djangodesktop-1024x768.jpg
File renamed without changes
View
0  ...a/img/desktops/djangodesktop-1152x864.jpg → ...c/img/desktops/djangodesktop-1152x864.jpg
File renamed without changes
View
0  .../img/desktops/djangodesktop-1280x1024.jpg → .../img/desktops/djangodesktop-1280x1024.jpg
File renamed without changes
View
0  .../img/desktops/djangodesktop-1600x1200.jpg → .../img/desktops/djangodesktop-1600x1200.jpg
Diff not rendered
View
0  .../img/desktops/djangodesktop-1680x1050.jpg → .../img/desktops/djangodesktop-1680x1050.jpg
Diff not rendered
View
0  media/img/desktops/djangodesktop-800x600.jpg → ...ic/img/desktops/djangodesktop-800x600.jpg
Diff not rendered
View
0  ...a/img/doc/icons/docicons-behindscenes.gif → ...c/img/doc/icons/docicons-behindscenes.gif
Diff not rendered
View
0  media/img/doc/icons/docicons-note.gif → static/img/doc/icons/docicons-note.gif
Diff not rendered
View
0  media/img/doc/icons/docicons-philosophy.gif → static/img/doc/icons/docicons-philosophy.gif
Diff not rendered
View
0  media/img/logos/django-logo-negative.eps → static/img/logos/django-logo-negative.eps
File renamed without changes
View
0  media/img/logos/django-logo-negative.png → static/img/logos/django-logo-negative.png
Diff not rendered
View
0  media/img/logos/django-logo-negative.svg → static/img/logos/django-logo-negative.svg
Diff not rendered
View
0  media/img/logos/django-logo-positive.eps → static/img/logos/django-logo-positive.eps
File renamed without changes
View
0  media/img/logos/django-logo-positive.png → static/img/logos/django-logo-positive.png
Diff not rendered
View
0  media/img/logos/django-logo-positive.svg → static/img/logos/django-logo-positive.svg
Diff not rendered
View
0  media/img/site/arrow-head-left.gif → static/img/site/arrow-head-left.gif
Diff not rendered
View
0  media/img/site/bbd_bg.gif → static/img/site/bbd_bg.gif
Diff not rendered
View
0  media/img/site/bbd_blogroll.gif → static/img/site/bbd_blogroll.gif
Diff not rendered
View
0  media/img/site/bbd_code.gif → static/img/site/bbd_code.gif
Diff not rendered
View
0  media/img/site/bbd_community.gif → static/img/site/bbd_community.gif
Diff not rendered
View
0  media/img/site/bbd_documentation.gif → static/img/site/bbd_documentation.gif
Diff not rendered
View
0  media/img/site/bbd_download.gif → static/img/site/bbd_download.gif
Diff not rendered
View
0  media/img/site/bbd_homepage.gif → static/img/site/bbd_homepage.gif
Diff not rendered
View
0  media/img/site/bbd_overview.gif → static/img/site/bbd_overview.gif
Diff not rendered
View
0  media/img/site/bbd_weblog.gif → static/img/site/bbd_weblog.gif
Diff not rendered
View
0  media/img/site/bbdsm_bg.gif → static/img/site/bbdsm_bg.gif
Diff not rendered
View
0  media/img/site/bbdsm_bg.gif.1 → static/img/site/bbdsm_bg.gif.1
File renamed without changes
View
0  media/img/site/djangoapi-logo.gif → static/img/site/djangoapi-logo.gif
Diff not rendered
View
0  media/img/site/download_bg-left.gif → static/img/site/download_bg-left.gif
Diff not rendered
View
0  media/img/site/download_bg-right.gif → static/img/site/download_bg-right.gif
Diff not rendered
View
0  media/img/site/hdr_logo.gif → static/img/site/hdr_logo.gif
Diff not rendered
View
0  media/img/site/hdr_meetdjango.gif → static/img/site/hdr_meetdjango.gif
Diff not rendered
View
0  media/img/site/invisible.gif → static/img/site/invisible.gif
Diff not rendered
View
0  media/img/site/mt.png → static/img/site/mt.png
Diff not rendered
View
0  media/img/site/nav_bg.gif → static/img/site/nav_bg.gif
Diff not rendered
View
0  media/img/site/screencast-back.gif → static/img/site/screencast-back.gif
Diff not rendered
View
0  media/img/site/screencast-next.gif → static/img/site/screencast-next.gif
Diff not rendered
View
0  media/img/site/somerights20.png → static/img/site/somerights20.png
Diff not rendered
View
6 templates/base.html
@@ -11,14 +11,14 @@
<meta name="Copyright" content="Django Software Foundation" />
<meta name="keywords" content="Python, Django, framework, open-source" />
<meta name="description" content="Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design." />
- <link href="{{ MEDIA_URL }}css/{% block cssid %}base{% endblock %}.css" rel="stylesheet" type="text/css" media="screen" />
- <link href="{{ MEDIA_URL }}css/print.css" rel="stylesheet" type="text/css" media="print" />
+ <link href="{{ STATIC_URL }}css/{% block cssid %}base{% endblock %}.css" rel="stylesheet" type="text/css" media="screen" />
+ <link href="{{ STATIC_URL }}css/print.css" rel="stylesheet" type="text/css" media="print" />
{% block extrahead %}{% endblock %}
</head>
<body id="{% block sectionid %}generic{% endblock %}" class="{% block coltype %}default{% endblock %}">
<div id="container">
<div id="header">
- <h1 id="logo"><a href="https://www.djangoproject.com/"><img src="{{ MEDIA_URL }}img/site/hdr_logo.gif" alt="Django" /></a></h1>
+ <h1 id="logo"><a href="https://www.djangoproject.com/"><img src="{{ STATIC_URL }}img/site/hdr_logo.gif" alt="Django" /></a></h1>
<ul id="nav-global">
<li id="nav-homepage"><a href="https://www.djangoproject.com/">Home</a></li>
<li id="nav-download"><a href="https://www.djangoproject.com/download/">Download</a></li>
View
2  templates/base_code.html
@@ -4,4 +4,4 @@
{% block title %}Code{% endblock %}
-{% block billboard %}<h2><a href="https://code.djangoproject.com/"><img src="{{ MEDIA_URL }}img/site/bbd_code.gif" alt="Django source code" /></a></h2>{% endblock %}
+{% block billboard %}<h2><a href="https://code.djangoproject.com/"><img src="{{ STATIC_URL }}img/site/bbd_code.gif" alt="Django source code" /></a></h2>{% endblock %}

0 comments on commit c5b01e7

Please sign in to comment.
Something went wrong with that request. Please try again.