Reputation: 1849
I'm using Django 1.4
My static files don't seem to be running or {{ STATIC_URL }} is wrong in the html file.
In the settings, I have the static files loaded:
STATICFILES_DIRS = (
'C:/Users/dtc/Documents/Eclipse/java_applet/applet',
)
STATIC_ROOT = ''
STATIC_URL = '/static/'
In url.py I have:
urlpatterns += staticfiles_urlpatterns()
In the html file, I have:
<html>
<title>The Hello, World Applet</title>
<img src="{{ STATIC_URL }}tets.png" />
<applet code="{{ STATIC_URL }}HelloWorldApplet.class" width="320" height="120">
If your browser was Java-enabled, a "Hello, World"
message would appear here.
</applet>
</html>
Now, when I runserver, I can download the static files from localhost:8000/static/file which means it should be there right? But when I load the page, neither the applet or the image is showing up. All I'm trying to do as an endgoal is to run an applet on my dev server but I can't seem to figure out why {{ STATIC_URL }} isn't working(I even added a backslash after it in case that was the reason).
Upvotes: 0
Views: 89
Reputation: 7327
Look at the RequestContext
class, this is probably what you're looking for.
See this answer on SO as well.
Upvotes: 1