Commit 102e763b authored by Alec Wang's avatar Alec Wang

added static directory settings to settings.py file

parent 4aca0776
{% load static %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
...@@ -6,7 +7,7 @@ ...@@ -6,7 +7,7 @@
</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> <dt>Health Points</dt>
......
from django.conf.urls import url
from django.conf import settings
from django.contrib import admin
from django.conf.urls import include, url
from django.conf.urls.static import static
from .views import * from .views import *
urlpatterns = [ urlpatterns = [
...@@ -6,4 +10,4 @@ urlpatterns = [ ...@@ -6,4 +10,4 @@ urlpatterns = [
url(r'^hero/cloud$', hero_cloud, name="hero_cloud"), url(r'^hero/cloud$', hero_cloud, name="hero_cloud"),
url(r'^hero/sunflowey$', hero_sunflowey, name="hero_sunflowey"), url(r'^hero/sunflowey$', hero_sunflowey, name="hero_sunflowey"),
url(r'^hero/jester$', hero_jester, name="hero_jester"), url(r'^hero/jester$', hero_jester, name="hero_jester"),
] ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
...@@ -119,3 +119,4 @@ USE_TZ = True ...@@ -119,3 +119,4 @@ USE_TZ = True
# 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 = '/static/'
STATICFILES_DIRS = (os.path.join(BASE_DIR, "heroes/templates/"),)
...@@ -13,10 +13,12 @@ Including another URLconf ...@@ -13,10 +13,12 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
""" """
from django.conf.urls import include, url from django.conf import settings
from django.contrib import admin from django.contrib import admin
from django.conf.urls import include, url
from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'', include('heroes.urls')), url(r'', include('heroes.urls')),
] ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
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