Last active
January 15, 2020 13:53
-
-
Save spidezad/b71f0dc165fb997d3c6d62f6904c7880 to your computer and use it in GitHub Desktop.
Django static files Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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