Saleor Django Apache mod_wsgi will not serve /static/admin/
Question: I am running the saleor django app under a virtualenv with apache as a non-
privileged user.

Actually getting everything going was fairly straightforward, but one bit is
confusing me.

The /static/admin/ portion of the site is not being served.

I have looked at the [deployment
docs](https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#serving-
files) and [other advice](http://stackoverflow.com/questions/3271731/djangos-
admin-pages-are-missing-their-typical-formatting-style-have-i-set-it-u) but
have found nothing that helps, so far.

My /static/ directory is being served just fine. I'm sure it's something very
obvious to the non-django-noob, but that's what I am. I'm not certain that
it's copacetic to alias a sub-directory in another aliased directory. I'd
rather not resort to symlinks.

    
    
    # dev-site.conf
    
    WSGIPythonPath/home/admin/project/saleor:/home/admin/project/venv/lib/python2.7/site-packages
    
    <VirtualHost *:80>
            ServerName example.com
            ServerAdmin email@example.com
            DocumentRoot "/home/admin/project"
    
            WSGIDaemonProcess example.com python-path=/home/admin/project/saleor:/home/admin/project/venv/lib/python2.7/site-packages
            WSGIProcessGroup example.com
            WSGIScriptAlias / /home/admin/project/saleor/wsgi.py
    
            Alias /media/ /home/admin/project/media/
            <Directory /home/admin/project/media/>
                    Require all granted
            </Directory>
    
            Alias /favicon.ico /home/admin/project/saleor/static/images/favicon.ico
            Alias /robots.txt /home/admin/project/saleor/static/robots.txt
            Alias /static/ /home/admin/project/saleor/static/
            <Directory /home/admin/project/saleor/static/>
                    Require all granted
            </Directory>
    
            Alias /static/admin/ /home/admin/project/venv/lib/python2.7/site-packages/django/contrib/admin/static/admin/
            <Directory /home/admin/project/venv/lib/python2.7/site-packages/django/contrib/admin/static/admin/>
                    Require all granted
            </Directory>
    
            <Directory /home/admin/project>
                    <Files wsgi.py>
                            Require all granted
                    </Files>
            </Directory>
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    </VirtualHost>
    
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    

I include my saleor/wsgi.py for smarts.

    
    
    # wsgi.py
    
    python
    
    import os
    import sys
    import site
    
    site.addsitedir("/home/admin/project/venv/lib/python2.7/site-packages")
    os.environ.setdefault("SECRET_KEY", "br549")
    os.environ.setdefault("MYSQL_DB_URL", "mysql://dbuser:doublesecret@dbuser-dev.example.com:3306/saleor")
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "saleor.settings")
    
    project = "/home/admin/project/saleor"
    workspace = os.path.dirname(project)
    sys.path.append(workspace)
    
    from django.core.wsgi import get_wsgi_application
    application = get_wsgi_application()
    


Answer: You shouldn't attempt to get Apache to serve directly from the static
directory of either your own apps or the admin app. Instead, follow the
documentation and use the `collectstatic` command to collect the static files
for all apps in one place and serve from there.

