Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django-sass-processor TypeError

So, I am new to Django, and cannot for the life of me figure out why I keep getting a TypeError on my view.

Error is:

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 the 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 am probably missing something in my settings.py, but not sure what it could be. Also, how do I link to my scss file?

I added the following in 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 should this point to? my app structure is

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

I thought its a Python3 error, so I buillt a 2.7 ve, but still have the exact same issue.

like image 784
Xuton Avatar asked Oct 20 '22 00:10

Xuton


1 Answers

I realized this went unanswered, but I did find the problem thanks to jrief

This needs to be in the settings file

INSTALLED_APPS = [
....
'sass_processor',
....
]

....
....

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

The link in the html

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

These weren't required

SASS_PROCESSOR_INCLUDE_DIRS = (
    os.path.join(BASE_DIR, 'app_name/static'),
)
STATICFILES_FINDERS = (
    'sass_processor.finders.CssFinder',
)
like image 123
Xuton Avatar answered Oct 21 '22 14:10

Xuton