Changes between Version 20 and Version 21 of DosAndDontsForApplicationWriters


Ignore:
Timestamp:
Aug 5, 2011, 7:10:41 AM (13 years ago)
Author:
Dan Poirier
Comment:

References to media appear to be meant to refer to static files. Correct that, and add links to current doc on using static files.

Legend:

Unmodified
Added
Removed
Modified
  • DosAndDontsForApplicationWriters

    v20 v21  
    5454     (e.g., a {{{<style>}}} or {{{<link>}}}s)
    5555   * {{{content}}}; the main content of the document
    56  * You should refer to media-files with a configurable prefix,
    57    in the example a good setting would be {{{MNEMOSYNE_MEDIA_ROOT}}}.
     56 * You should refer to static files relative to the setting STATIC_URL, per https://docs.djangoproject.com/en/1.3/howto/static-files/#referring-to-static-files-in-templates.
    5857   For example:
    5958   {{{
    60 <link rel='stylesheet' href='{{ MNEMOSYNE_MEDIA_ROOT }}/my.css' />
     59<link rel='stylesheet' href='{{ STATIC_URL }}/my.css' />
    6160   }}}
    6261 * You should refer to pages in your application with either relative links,
     
    7372   own views.
    7473
    75 == Media files ==
     74== Static files ==
    7675 
    77  * Your media-files should go into {{{mnemosyne/media/}}}.
    78    ''Should that be ''{{{mnemosyne/media/mnemosyne/}}}''? It would mirror
    79    the templates, and probably looks better in ''{{{Alias}}}''-directives
    80    in Apache-configurations ;)''
     76 * Your static files should go into {{{static}}} subdirectories of your app directories.  See https://docs.djangoproject.com/en/1.3/howto/static-files/#basic-usage. Or if they're not specific to one app, create a {{{static}}} directory at the top of your project, put them there, and add that directory to STATICFILES_DIRS.
    8177
    8278== Settings ==
     
    135131      package_dir = {'': 'src'},
    136132      package_data = {'ibofobi.apps.mnemosyne': ['templates/mnemosyne/*.html',
    137                                                  'media/*',],},
     133                                                 'static/*',],},
    138134      # distutils complain about these, anyone know an easy way to silence it?
    139135      namespace_packages = ['ibofobi.apps'],
Back to Top