Django-sass-processor TypeError

So, I'm new to Django and can't understand for life why I keep getting TypeError in my view.

Error:

TypeError at / filename must be a string, not None Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.8.5 Exception Type: TypeError Exception enter code hereValue: filename must be a string, not None 

I have the following in view

 <!DOCTYPE html> {% load sass_tags %} <html> <head lang="en"> ... <link href="{% sass_src 'app_name/static/theme.scss' %}" media="screen" rel="stylesheet" type="text/css"> 

I probably missed something in my .py settings, but I'm not sure what it might be. Also, how can I link to my scss file?

I added the following to my settings.py

 INSTALLED_APPS = [ .... 'sass_processor', .... ] STATICFILES_FINDERS = ( 'sass_processor.finders.CssFinder', ) 

I think my problem lies here

 SASS_PROCESSOR_INCLUDE_DIRS = ( os.path.join(BASE_DIR, 'app_name/static'), ) 

BASE_DIR refers to

  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 

Where exactly is this needed? my application structure

 app_dir/ Specs/ src/ app_name/ static/ theme.scss templates/ __init__.py views.py etc... 

I thought this was a Python3 bug, so I am creating 2.7 V, but still have the same problem.

+5
source share
1 answer

I realized that this did not get an answer, but I found the problem thanks to jrief

It should be in the settings file

 INSTALLED_APPS = [ .... 'sass_processor', .... ] .... .... STATIC_ROOT = os.path.join(BASE_DIR, 'app_name/static/') STATIC_URL = '/static/' 

Link in html

<link href="{% sass_src 'filename.scss' %}" rel="stylesheet" type="text/css" / ">

It was not required

 SASS_PROCESSOR_INCLUDE_DIRS = ( os.path.join(BASE_DIR, 'app_name/static'), ) STATICFILES_FINDERS = ( 'sass_processor.finders.CssFinder', ) 
+3
source

Source: https://habr.com/ru/post/1233408/


All Articles