0

So basically I've deployed my applicaiton on vps with apache and mod wsgi. For my static files I've used {% url %} template tag like this :

<link href="{% static "bootstrap.min.css" %}" rel="stylesheet">

Django wasn't loading static files because it was creating relative url so I fixed it by

<link href="/{% static "bootstrap.min.css" %}" rel="stylesheet">

But now when I go to /admin pages it's not loading static files, again because of the relative urls. How can I fix this ?

Here's my mod wsgi :

import os
import sys
import site

# Add the app's directory to the PYTHONPATH
sys.path.append('/home/tshirtnation')
sys.path.append('/home/tshirtnation/tshirtnation')

os.environ['DJANGO_SETTINGS_MODULE'] = 'tshirtnation.settings'
os.environ['PYTHON_EGG_CACHE'] = '/tmp'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

And my apache configuration :

#Listen 80

<VirtualHost *:80>
        ServerAdmin marijus.merkevicius@gmail.com
        ServerName 5.199.166.109
        WSGIDaemonProcess ts threads=25
        WSGIProcessGroup ts
        Alias /static /home/tshirtnation/staticfiles
        WSGIScriptAlias / /home/tshirtnation/index.wsgi
</VirtualHost>

Let me know if you need anything else.

Marijus
  • 4,195
  • 15
  • 52
  • 87

1 Answers1

0

I also had a problem with Django's admin static files. That's what I used. Maybe it can be helpful.

This is for Nginx:

location /static/admin {
    alias "/pythonenv_path/lib/python3.2/site-packages/django/contrib/admin/static/admin";
}
Sergey
  • 19,487
  • 13
  • 44
  • 68