There are 3 main things we need to do:
set STATIC_ROOT in settings.py
run python manage.py collectstatic (or python3.5 or python3.6 as appropriate) Example: python manage.py collectstatic
set up a Static Files entry on the PythonAnywhere Web tab.
we can also customise STATIC_URL, if we want to use a static URL prefix other than /static/
STATIC_ROOT = os.path.join(BASE_DIR, ‘assets’)
Set url.py to load template
from .views import indexPageView
urlpatterns = [
path('', indexPageView, name='index')]
Read Complete: https://realprogrammer.in/how-to-setup-static-files-in-django-2-2/
Top comments (0)