Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One possibility - STATIC_URL won't be filled out in your templates unless you're passing in a RequestContext.</p> <p>Make sure you have something like this in your views:</p> <pre><code>return render_to_response(template, context, context_instance=RequestContext(request)) </code></pre> <p>As of Django 1.3 you can also use the new shortcut:</p> <pre><code>return render(request, template, context) </code></pre> <p>Also, make sure you have 'django.core.context_processors.static' in your context processors.</p> <hr> <p>EDIT: Possible answer to the second problem, try changing</p> <pre><code>STATICFILES_DIRS = ( os.getcwd().replace('\\','/') + '/static' ) </code></pre> <p>to </p> <pre><code>STATICFILES_DIRS = ( os.getcwd().replace('\\','/') + '/static', ) </code></pre> <hr> <p>EDIT 2: More possible fixes</p> <p>You can delete STATICFILES_FINDERS. You only have it set to the default, so unless you intend to expand it later on, get rid of it (one less thing to go wrong).</p> <p>You can also get rid of the urlpatterns entry. Not necessary.</p> <p>Your STATIC_ROOT is probably incorrect. This should be the place where Django will gather all the static files from across your project (including the directories described in STATICFILES_DIRS) when you move to production.</p> <p>An example from a typical settings.py of mine:</p> <pre><code>PROJECT_DIR = os.path.dirname(__file__) STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(PROJECT_DIR, 'static'), ) STATIC_ROOT = '/var/www/myproject_staticfiles/' </code></pre> <p>That's it!</p> <p>If you want to test whether Django is finding and placing your static files correctly, try running </p> <pre><code>python manage.py collectstatic </code></pre> <p>In my case, that would go through my project directories, find all the static files, then copy them across to '/var/www/myproject_staticfiles/', where I can host them with apache.</p> <p>The Django dev server automagically serves static files from within your project folder, so no collect_static is required while in dev. You don't even need to set STATIC_ROOT until you go into production.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload