html - How to load static files in python django -
i have tried modify in settings.py file allow loading css files of html code still doesn't appear style, run in terminal command "python manage.py collectstatic" , says files copied still doesn't appear effect.
here modified lines in settings.py file
static_root = '/static/' staticfiles_dirs = [ os.path.join(base_dir, "static"), ] static_url = '/static/'
in settings.py provide:
staticfiles_finders = [ 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', ] base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) staticfiles_dirs = (os.path.join(base_dir, 'static_files'), ) static_root = os.path.join(base_dir, 'static', ) static_url = 'http://example.com/static/' so if static files finders defined , static_files declared source static files, whatever place in
/your_root/static_files/ will come
/your_root/static after run
python manage.py collectstatic the mistake with
staticfiles_dirs = [ os.path.join(base_dir, "static"), ] is you're trying take , bring same directory, destination directory of static files collected.
Comments
Post a Comment