Skip to content

Instantly share code, notes, and snippets.

@spidezad
Last active January 15, 2020 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spidezad/b71f0dc165fb997d3c6d62f6904c7880 to your computer and use it in GitHub Desktop.
Save spidezad/b71f0dc165fb997d3c6d62f6904c7880 to your computer and use it in GitHub Desktop.
Django static files Notes
# update settings.py for new app
# create views.py in app
# create urls.py in app
# update urls.py in main
# add in various html template in app_name/templates
# for the html template
{% load static %}
# specifying a static file
<link rel="stylesheet" type="text/css" href="{% static 'appsname/style.css' %}">
# overriding tempalates
https://docs.djangoproject.com/en/3.0/howto/overriding-templates/
# default template place in app_name/templates
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),]
# need to have this file created first.
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment