MegaMark16 / django-cms-themes

A way to quickly load and swap out template packs (or themes) for Django CMS
BSD 3-Clause "New" or "Revised" License
49 stars 15 forks source link

Theme not loading static files #11

Open chrisfranklin opened 11 years ago

chrisfranklin commented 11 years ago

Hey,

I am attempting to use the following path in my templates:

{{ STATIC_URL }}themes/chequers/static/

For example:

<link rel="stylesheet" href="{{ STATIC_URL }}themes/chequers/static/css/gumby.css">

My theme is called chequers and the directory structure is as follows:

chequers
├── config.rb
├── README.md
├── static
│   ├── apple-touch-icon.png
│   ├── apple-touch-icon-precomposed.png
│   ├── component.json
│   ├── css
│   │   ├── font-awesome.min.css
│   │   ├── gumby.css
│   │   └── style.css
│   ├── facebook.jpg
│   ├── favicon.png
│   ├── fonts
│   │   ├── CARDIF_B.eot
│   │   ├── CARDIFBI.eot
│   │   ├── CARDIFBI.TTF
│   │   ├── CARDIF_B.TTF
│   │   ├── CARDIF__.eot
│   │   ├── CARDIF_I.eot
│   │   ├── CARDIF_I.TTF
│   │   ├── CARDIF__.TTF
│   │   ├── FontAwesome.otf
│   │   ├── fontawesome-webfont.eot
│   │   ├── fontawesome-webfont.svg
│   │   ├── fontawesome-webfont.ttf
│   │   ├── fontawesome-webfont.woff
│   │   └── icons
│   │       ├── entypo.eot
│   │       ├── entypo.ttf
│   │       └── entypo.woff
│   ├── humans.txt
│   ├── img
│   │   ├── bg.svg
│   │   ├── gumby_mainlogo@2x.png
│   │   ├── gumby_mainlogo.png
│   │   └── img_silence_demo.jpg
│   ├── js
│   │   ├── libs
│   │   │   ├── gumby.js
│   │   │   ├── gumby.min.js
│   │   │   ├── jquery-1.8.3.min.js
│   │   │   ├── modernizr-2.6.2.min.js
│   │   │   └── ui
│   │   │       ├── gumby.checkbox.js
│   │   │       ├── gumby.fixed.js
│   │   │       ├── gumby.radiobtn.js
│   │   │       ├── gumby.retina.js
│   │   │       ├── gumby.skiplink.js
│   │   │       ├── gumby.tabs.js
│   │   │       ├── gumby.toggleswitch.js
│   │   │       └── jquery.validation.js
│   │   ├── main.js
│   │   └── plugins.js
│   └── sass
│       ├── _base.scss
│       ├── _custom.scss
│       ├── _fonts.scss
│       ├── functions
│       │   ├── _all.scss
│       │   ├── _breakpoints.scss
│       │   ├── _buttons.scss
│       │   ├── _forms.scss
│       │   ├── _grid-calc.scss
│       │   ├── _height-calc.scss
│       │   ├── _line-and-height.scss
│       │   ├── _responsivity.scss
│       │   ├── _strip-units.scss
│       │   └── _typography.scss
│       ├── _grid.scss
│       ├── gumby.scss
│       ├── _typography.scss
│       ├── ui
│       │   ├── _all.scss
│       │   ├── _buttons.scss
│       │   ├── _forms.scss
│       │   ├── _icons.scss
│       │   ├── _images.scss
│       │   ├── _labels.scss
│       │   ├── _navbar.scss
│       │   ├── _tabs.scss
│       │   └── _video.scss
│       └── var
│           ├── icons
│           │   ├── _entypo-icon-list.scss
│           │   └── _entypo.scss
│           ├── _lists.scss
│           └── _settings.scss
└── templates
    ├── index.html
    └── template_2.html

I do not seem to be able to load any static files and I am unsure of how to debug the problem. Any help would be appreciated. Thanks a lot!

chrisfranklin commented 11 years ago

I have noticed I need to set these two settings to avoid an error when uploading a theme:

DEFAULT_TEMPLATE_DIRS = TEMPLATE_DIRS
DEFAULT_STATICFILES_DIRS = STATICFILES_DIRS

I have also noticed I need to delete the .git folder before uploading the theme tarball or I get a permissions error.

chrisfranklin commented 11 years ago

This line is causing a problem: https://github.com/MegaMark16/django-cms-themes/blob/master/cms_themes/__init__.py#L62

It generates this error:

An error occured setting up the themes: No module named conf.patch
Validating models...

0 errors found
Django version 1.4.5, using settings 'tart.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Possibly related to this:

https://github.com/divio/django-cms/pull/1565/files

chrisfranklin commented 11 years ago

It might need to be blank or

from cms import constants 

now instead.

chrisfranklin commented 11 years ago

Adding:

STATICFILES_DIRS = (
    ("themes", os.path.join(PROJECT_PATH, "themes/")),
)

Fixed the problem but it should be getting set as I have THEME_DIR set.

ethoms commented 10 years ago

Thanks chrisfranklin, you helped me clear those errors myself. I have a question: I can install the theme from the admin site, but I have to manually add the theme templates to settings.py ( TEMPLATE_DIRS & CMS_TEMPLATES). Is this how it should be?

chrisfranklin commented 10 years ago

Yeah I think so mate, would using the same names across your themes work? E.g. home.html, about.html etc