title: Difference between static STATIC_URL and STATIC_ROOT on Django
body: <p>I am confused by <code>static root</code> and want to clarify things.</p>
  
  <p>To serve static files in Django, the following should be in <code>settings.py</code> and <code>urls.py</code>:</p>
  
  <pre><code>import os
  PROJECT_DIR=os.path.dirname(__file__)
  </code></pre>
  
  <h1>1. Absolute path to the directory in which static files should be collected</h1>
  
  <pre><code>STATIC_ROOT= os.path.join(PROJECT_DIR,'static_media/')
  </code></pre>
  
  <h1>2. URL prefix for static files</h1>
  
  <pre><code>STATIC_URL = '/static/'
  </code></pre>
  
  <h1>3. Additional locations for static files</h1>
  
  <pre><code>STATICFILES_DIRS = ( os.path.join(PROJECT_DIR,'static/'),)
  </code></pre>
  
  <p>...and in <code>urls.py</code> the following lines:</p>
  
  <pre><code>from django.contrib.staticfiles.urls import staticfiles_urlpatterns
  urlpatterns += patterns('', (
      r'^static/(?P&lt;path&gt;.*)$',
      'django.views.static.serve',
      {'document_root': settings.STATIC_ROOT}
  ))
  </code></pre>
  
  <h1>4. We also use <code>python manage.py collectstatic</code></h1>
  
  <p>Questions:</p>
  
  <ol>
  <li><p>Could anyone please explain the workflow to me: how should things ideally be done. As of now, I copy/paste the above code snippets into their designated locations and continue making new files in the static directory and it works. In my <code>settings.STATIC_ROOT</code>, however, I have pointed to a different directory. </p></li>
  <li><p>It would be great if someone could explain the workflow of each setting: how files are collected and managed, and what would be a good practice to follow. </p></li>
  </ol>
  
  <p>Thanks. </p>