10


If anyone knows how to make django-cms play with grappelli, please give some tips

iperelivskiy
  • 3,523
  • 2
  • 18
  • 19

3 Answers3

5

Well I've just gone through a fairly epic adventure, the story of which might be of some use to you. The end point of said adventure was getting django-cms 2.1.3 working with django-filebrowser-no-grappelli . Whilst that may sound in fact like the opposite of what you want, I ended up there because what I really wanted was to get django-cms working with filebrowser. Without grappelli though the standard django-filebrowser does not work as expected. But with grappelli django-cms does not work as expected. So therein lay the rub, to quote shakespeare. Getting django-cms working with filebrowser was relatively straight forward except for the fact that when trying to upload files with uploadify (which is shipped with filebrowser), after selecting the files in the file dialog, nothing happened. Eventually I figured out that this was because the jquery library was being loaded twice: once by filebrowser for use with uploadify, and once by django-cms. So by commenting out the second line in this file:

your site packages dir/cms/templates/cms/toolbar/toolbar.html

which loads jquery.min.js, uploadify worked as expected. Soooo...if you just want to get django-cms working with grappelli so you can use filebrowser, the above might be helpful. Here is my settings file for reference.

eedeep
  • 12,183
  • 3
  • 18
  • 14
  • thanks for your reply. as for me filebrowser aint a reason to use grappelli ;). though i have faced this issue once. can't say this was a fairly epic adventure :) but it took some time to fix it. So I want to use grappelli just for its slick UI. – iperelivskiy Apr 11 '11 at 01:25
  • 1
    Well yeah it just took a whlie to fix because there were no javascript errors as such, so it was harder to debug. But it just occurred to me that the underlying reason for uploadify not working due to jquery being loaded twice is the fact that the django-cms toolbar was showing up in the admin interface but only in the filebrowser window. I suspect that toolbar may not even supposed to show up when you're in admin. So a better fix might be to find out why the toolbar is showing up in the first place and then stop that happening. ANyway let us know how you go with django-cms + grappelli... – eedeep Apr 11 '11 at 01:45
  • Just an update on the above..the django-cms toolbar was showing because I had erroneously included url(r'^filebrowser/', include('filebrowser.urls')) in addition to url(r'^admin/filebrowser/', include('filebrowser.urls')). All I needed was the latter. I did however find a similar issue with TinyMCE and filebrowser and the django-cms toolbar, which I have started a discussion about [here](http://bit.ly/eXzjH3) – eedeep Apr 11 '11 at 06:33
2

My solution is to implement 2 subdomains, 'www' and 'cms', in each of which a separate instance of the Django site is running with a different STATIC_ROOT and a modified INSTALLED_APPS. grappelli runs in the 'www' subdomain. It is not running in the 'cms' subdomain, so that you can use django-cms there.

  • Set up a subdomain: cms.example.com

  • Modify your webserver to serve this subdomain. Use the same settings as your main django site but point to a different script handler. e.g. if using wsgi direct the server to run wsgi_cms.py

  • cp wsgi.py wsgi_cms.py. Edit wsgi_cms.py and change the line

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings") to os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings_cms")

  • settings_cms.py :

:

from settings import *

INSTALLED_APPS.remove('grappelli.dashboard')
INSTALLED_APPS.remove('grappelli')
STATIC_ROOT = os.path.join('/what/ever/static_cms/')
STATIC_URL = '/static_cms/'
ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/`
  • modify settings.py: change INSTALLED_APPS from a tuple to a list

  • restart web servers

  • ./manage.py collectstatic --settings=myproject.settings_cms

  • your regular site continues as normal. To edit django-cms pages with grappelli disabled go to http://cms.example.com/admin/cms/page/

scytale
  • 12,346
  • 3
  • 32
  • 46
  • Does this solution result in using django-cms WITH grappelli skin ? Generally grappelli works with django-cms until you start editing pages ... – Hacking Life Jan 08 '13 at 16:57
  • no, sorry if my answer was not clear. my solution creates 2 domains - www.example.com which uses grappelli in the admin, and cms.example.com which has the regular django admin interface. Since the whole point of django-cms is to edit pages, and since grappelli breaks this I don't agree that "Generally grappelli works with django-cms". – scytale Jan 08 '13 at 17:02
0

I've once made a django-cms fork on github that supports grappelli, it's a bit outdated, but maybe helps you to get started or probaly you'd like to contribute.

Bernhard Vallant
  • 49,468
  • 20
  • 120
  • 148
  • is it possible not to fork django-cms but create standalone app? – iperelivskiy Apr 10 '11 at 08:25
  • 2
    of course it is. i mean standalone in a lil bit different sense. for example, u don't have to fork contrib.admin to use grappelli, right? roughly speaking, it is independent app working on top of contrib.admin. you can have or not have it in INSTALLED_APPS while contrib.admin still works. and django way it is, i think. so my question was about building an app this way. – iperelivskiy Apr 11 '11 at 01:06