static

static! static everywhere!

So having turned my Django debug to false, I realise it no longer serves static files for me and my webserver is not doing its part in holding up its end of the bargain!

Talk about dropping the ball!

drop-ball-o

 

I’m still figuring out how to set up my webserver to handle static files. Is it a matter of changing the links in my settings.py and urls.py to hardcode them to my website? Or do I have to get my hosting to set up Apache’s httpd.conf to serve static files (which I do not have access to)

Advertisements

{% static %} files

Now i’ve finally moved on to creating my own¬†templates within django/wagtail. But first I have a bit of an issue with the static files.

When I attempt to add images in Wagtail,

Picture 12

I get the dreaded Internal Server Error

Internal Server Error
The server encountered an internal error or 
misconfiguration and was unable to complete 
your request.

 

 

 

 

 

 

 

 

Picture 11

 

Additionally, attempting to link to images in my static folder like so:

<p><img src="{% static "its_alive1.gif" %}" alt="Its Alive" /></p>

gives a broken image, although if I navigate to http://username.com/static/image.gif I can see the image in my browser.

Right now my settings.py are as follow:

MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
STATIC_URL = '/home/clarayee/website/static/'
STATICFILES_DIRS = ()

The STATIC_URL is a hard-rooted to test if it makes any difference. Nope, no difference!