Internal server error; offline compression; plain html / no styling

329 views
Skip to first unread message

Sven Hinz

unread,
Jun 7, 2015, 12:32:52 PM6/7/15
to wag...@googlegroups.com
Dear Wagtail support,

I'm trying to get my server running with Wagtail. I already tried it with the current stable version and the new beta. In both cases it's the same problem.
The server is running with Apache2 and mod_wsgi on Ubuntu 14.04 LTS. It works with an other Django project.

After restarting the Apache server I get

Internal server error

Sorry, there seems to be an error. Please try again soon.


I enabled logging to find out what's the problem:
OfflineGenerationError: You have offline compression enabled but key "d7d89fsd989df9f8d9df78" is missing from offline manifest. You may need to run "python manage.py compress".

I searched the Internet for a solution and added two lines to my settings/base.py:

COMPRESS_ENABLED = True

COMPRESS_OFFLINE = True


and run
$> ./manage.py compress

That seems to work. But after that there is no styling on the wagtail home and admin pages.
So why do I need to set the COMPRESS settings to true? If this would be necessary, you would deliver wagtail with this settings, right? I think there is something else wrong. I hope we can find it out.

Thanks in advance!

$> pip freeze

beautifulsoup4==4.3.2

cffi==1.1.0

cryptography==0.9.1

Django==1.8.2

django-appconf==1.0.1

django-compressor==1.5

django-libsass==0.3

django-modelcluster==0.6.2

django-sendfile==0.3.7

django-taggit==0.14.0

django-treebeard==3.0

enum34==1.0.4

html5lib==0.999

idna==2.0

ipaddress==1.0.7

libsass==0.8.2

ndg-httpsclient==0.4.0

Pillow==2.8.2

psycopg2==2.5.2

pyasn1==0.1.7

pycparser==2.13

pyOpenSSL==0.15.1

pytz==2015.4

requests==2.7.0

six==1.9.0

South==1.0.2

unicodecsv==0.13.0

Unidecode==0.4.17

wagtail==1.0b2

wheel==0.24.0

Willow==0.2



Matthew Westcott

unread,
Jun 7, 2015, 1:06:28 PM6/7/15
to wag...@googlegroups.com
Hi Sven,
We do enable those settings, in settings/production.py:
https://github.com/torchbox/wagtail/blob/v1.0b2/wagtail/project_template/project_name/settings/production.py
(COMPRESS_ENABLED defaults to True when DEBUG is False)

If './manage.py compress' didn't work without those extra lines in settings/base.py, it probably means you need to specify production.py as your settings file when running it:

./manage.py compress --settings=myproject.settings.production


As well as running the 'compress' command, you need to run 'collectstatic' and configure Apache to serve static files directly, as detailed in the Django documentation:
https://docs.djangoproject.com/en/1.8/howto/static-files/deployment/


(Incidentally - the COMPRESS_ENABLED setting will be taken out of settings/production.py in Wagtail 1.0 final, because it's not absolutely necessary, and we're working on making the project template as simple and non-opinionated as possible.)

Cheers,
- Matt

Sven Hinz

unread,
Jun 7, 2015, 4:16:02 PM6/7/15
to wag...@googlegroups.com
HI Matt,

Thanks a lot for the quick answer!

If I understand right, the apache server runs the wsgi.py, which uses the production settings. But it doesn't run the compress and collect static commands before starting.

Running the compress/collectstatic command manually worked. But there is an error after running ./manage.py compress --settings=myproject.settings.production :

CommandError: An error occured during rendering /var/www/website/core/templates/base.html: 'css/website.css' could not be found in the COMPRESS_ROOT '/var/www/website/static' or with staticfiles.


My apache config has now the static path included. But I'm still getting the compress error like before.

Thanks,
Sven

Matthew Westcott

unread,
Jun 8, 2015, 4:46:12 AM6/8/15
to wag...@googlegroups.com
On 7 Jun 2015, at 21:16, Sven Hinz <sv....@googlemail.com> wrote:

> HI Matt,
>
> Thanks a lot for the quick answer!
>
> If I understand right, the apache server runs the wsgi.py, which uses the production settings. But it doesn't run the compress and collect static commands before starting.

That's correct - normally you would run these as part of deploying new code to the server.

> Running the compress/collectstatic command manually worked. But there is an error after running ./manage.py compress --settings=myproject.settings.production :
>
> CommandError: An error occured during rendering /var/www/website/core/templates/base.html: 'css/website.css' could not be found in the COMPRESS_ROOT '/var/www/website/static' or with staticfiles.

Where is your website.css file located? (The conventional location would be website/core/static/css/website.css.)

Cheers,
- Matt

Sven Hinz

unread,
Jun 8, 2015, 11:55:19 AM6/8/15
to wag...@googlegroups.com
The file in static/css/ ist called website.scss. Renaming it to website.css doesn't change anything.

Sven Hinz

unread,
Jun 8, 2015, 1:49:04 PM6/8/15
to wag...@googlegroups.com
Allright. Of course I had to run the compress command again. It works now.

But it's strange that I had to rename the .scss file. Why?

Anyway... Thank you for your help!

Matthew Westcott

unread,
Jun 8, 2015, 3:47:47 PM6/8/15
to wag...@googlegroups.com
Looks like that was a bug in the project template in 1.0b2... the line in base.html was changed from website.scss to website.css when we dropped the requirement for libsass <https://github.com/torchbox/wagtail/commit/ddebafa1199134606012f57246780bc5d1608337#diff-6e54be463ea4c838fdf93d5780fddcf1L14>, but it seems we forgot to rename the file itself.

This code has now been replaced, so this bug won't arise in 1.0 final (the new project template doesn't include a base.html at all).

Cheers,
- Matt
Reply all
Reply to author
Forward
0 new messages