title: My foo.js works in Django runserver but in Apache (wsgi) i get 404. Why?
body: <p>Every url works fine in both Apache and django runserver except for urls (pointing to views, not real files) like this:</p>
  
  <pre><code>foo.js
  </code></pre>
  
  <p><strong>urls.py:</strong></p>
  
  <pre><code>url(r'^foo.js$', 'myapp.views.foo', name="foo"),
  </code></pre>
  
  <p><strong>views.py:</strong></p>
  
  <pre><code>def foo(request):
      return HttpResponse("foo")
  </code></pre>
  
  <p>In <strong>development server</strong> calling this url outputs me <code>foo</code></p>
  
  <p>In <strong>Apache</strong> with mod_wsgi, with the same url i get <code>404</code></p>
  
  <p><strong>wsgi conf file</strong> (really basic):</p>
  
  <pre><code>import os
  import sys, logging
  
  sys.stdout = sys.stderr
  
  path = '/var/www/vhosts'
  if path not in sys.path:
     sys.path.insert(0, path)
     sys.path.insert(0, path + '/myapp')
  
  os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
  
  import django.core.handlers.wsgi
  application = django.core.handlers.wsgi.WSGIHandler()
  </code></pre>
  
  <p>Classic urls like <code>/foo/</code> work as expected.</p>
  
  <p>Where is the problem? Is it an apache behaviour that i don't know / recognize? Is it Django routing?</p>
  
  <p><strong>edit</strong>:</p>
  
  <p>After adding apache conf (thanks for the maybe obvious hint), i think that those AliasMatch on *.js are the problem.. i completely forgot them!</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
          DocumentRoot "/var/www/vhosts/myapp"
          ServerName www.myapp.local
  
  
      Alias /robots.txt  /var/www/vhosts/myapp/public/static/robots.txt
      Alias /favicon.ico /var/www/vhosts/myapp/public/static/favicon.ico
  
      AliasMatch ^/([^/]*\.css) /var/www/vhosts/myapp/public/static/$1
      AliasMatch ^/([^/]*\.js)  /var/www/vhosts/myapp/public/static/$1
  
  
      Alias /media/  /var/www/vhosts/myapp/public/media/
      Alias /static/ /var/www/vhosts/myapp/public/static/
  
      &lt;Directory /var/www/vhosts/myapp&gt;
                  Order allow,deny
                  Allow from all
          &lt;/Directory&gt;
  
          WSGIDaemonProcess myapp.djangoserver processes=2 threads=15 display-name=%{GROUP}
          WSGIProcessGroup myapp.djangoserver
  
          WSGIScriptAlias / /var/www/vhosts/myapp/apache/django.wsgi
  LogLevel info
  &lt;/VirtualHost&gt;
  </code></pre>