Commit 4575749f authored by Santino Campos's avatar Santino Campos

Fix displaying of static images in website

parent 0424be22
{% load static %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Detail - Cloud</title> <title>Detail - Cloud</title>
</head> </head>
<body> <body>
<img src="./cloud.png" style="width: 10vw;" /> <img src='{% static "cloud.png" %}' style="width: 10vw;" />
<h1>Detail - Cloud</h1> <h1>Detail - Cloud</h1>
<dl> <dl>
<dt>Health Points</dt><dd>600</dd> <dt>Health Points</dt><dd>600</dd>
......
{% load static %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Detail - Jester</title> <title>Detail - Jester</title>
</head> </head>
<body> <body>
<img src="./jester.png" style="width: 10vw;"/> <img src="{% static "jester.png" %}" style="width: 10vw;" />
<h1>Detail - Jester</h1> <h1>Detail - Jester</h1>
<dl> <dl>
<dt>Health Points</dt><dd>660</dd> <dt>Health Points</dt><dd>660</dd>
......
{% load static %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Detail - Sunflowey</title> <title>Detail - Sunflowey</title>
</head> </head>
<body> <body>
<img src="./sunflowey.png" style="width: 10vw;" /> <img src='{% static "sunflowey.png" %}' style="width: 10vw;" />
<h1>Detail - Sunflowey</h1> <h1>Detail - Sunflowey</h1>
<dl> <dl>
<dt>Health Points</dt><dd>650</dd> <dt>Health Points</dt><dd>650</dd>
......
...@@ -26,7 +26,7 @@ class NewVisitorTest(unittest.TestCase): ...@@ -26,7 +26,7 @@ class NewVisitorTest(unittest.TestCase):
# containing more information about the hero (additional stats, lore, image). # containing more information about the hero (additional stats, lore, image).
self.browser.get('http://localhost:8000/hero/sunflowey') self.browser.get('http://localhost:8000/hero/sunflowey')
self.assertIn('<img src="./sunflowey.png" style="width: 10vw;">', self.browser.page_source) self.assertIn('<img src="/heroes/templates/sunflowey.png" style="width: 10vw;">', self.browser.page_source)
self.assertIn('<dt>Health Points</dt><dd>650</dd>', self.browser.page_source) self.assertIn('<dt>Health Points</dt><dd>650</dd>', self.browser.page_source)
self.assertIn('<dt>Base Attack Damage</dt><dd>43</dd>', self.browser.page_source) self.assertIn('<dt>Base Attack Damage</dt><dd>43</dd>', self.browser.page_source)
self.assertIn('<dt>Skills</dt><dd>Power Pellet, Sunshine, Pollen Punch</dd>', self.browser.page_source) self.assertIn('<dt>Skills</dt><dd>Power Pellet, Sunshine, Pollen Punch</dd>', self.browser.page_source)
......
...@@ -118,4 +118,8 @@ USE_TZ = True ...@@ -118,4 +118,8 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/ # https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/heroes/templates/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'heroes/templates'),
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment