Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » Serving static files and using sphene with multiple websites

I've successfully integrated Sphene into a website I'm developing, except I can't get the folder icons to appear.

I've tried this (site_media is where I put my static files), but no luck:
(r'^static/sphene/(.*)$', 'django.views.static.serve', {'document_root': '/home/doug/django/bbjsupport/sct-0.5/communitytools/static/sphene/' }),
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/doug/django/bbjsupport/site_media/',
'show_indexes': True}),


On another question, I'm wanting to use Sphene in several completely different websites. I've read here that there's another way of doing this besides integrating sphene directly into your website. I like the way it works now for me, but I was wondering the pros and cons.

Thanks!
I've tried this (site_media is where I put my static files), but no luck:
this looks right, have you correctly set MEDIA_URL in your settings.py? how are the folder icons referenced in the HTML code? maybe you could paste the HTML code..

btw. the url conf you pasted should only be used during development, when using it in production it is easier to let it be served directly by the webserver - e.g. in apache a simple alias would do the trick - my apache config looks like:

        Alias /static/sphene /opt/python/communitytools/static/sphene
        Alias /media /opt/python/goim/django_src/django/contrib/admin/media





On another question, I'm wanting to use Sphene in several completely different websites. I've read here that there's another way of doing this besides integrating sphene directly into your website. I like the way it works now for me, but I was wondering the pros and cons.


i am not sure if i understand what you mean - but i guess you are referring to 'community Groups' - these allow you to have different "virtual hosts" running on the same instances.
i see the cons/pros this way: if you want to easily create multiple websites with basically the same functiuonality, just different content.. simply create different 'Groups'.. but if you are going to develop every page separately anyway your needs are probably satisfied by having multiple instances running and just one community Group.

so - for example.. http://sct.sphene.net/ and https://herbert.poul.at/ etc. run on the same instance because it only uses the "basic" functionality of SCT without much customization, but other websites where most functionality is custom-built run on their own instance.. (you also have to consider that separation by Group's only work for SCT applications - so if you using other django applications like django-messages etc. these are not aware of the separation - the same goes for users obviously.. since you are registered here, you could just as easily log into https://herbert.poul.at/ :) - this is usually no problem i guess, but could confuse users if they can't see a connection between two websites..)

i hope this somehow answers your question..
Hey, we have Signatures !!! Great, isn't it ? ;)
Thanks! I'm new to django, I had no idea I had to change MEDIA_URL. I changed this line in settings.py and somehow it worked. :-) MEDIA_URL = 'http://localhost:8000/static/'

I can't really risk people on one website accessing the boards on other websites, so I think I'll stick to embedding sphene in each website. It seems easy enough.

Not to abuse your hospitality, but do you know why I'm getting this error when I click on "Notify me by email on new posts." ?

Page not found (404)
Request Method:
GET
Request URL:
http://localhost:8000/board/togglemonitor_group//
Using the URLconf defined in bbjsupport.urls, Django tried these URL patterns, in this order:
^bbjsupport/$
^bbjsupport/(?P<Ranking>\d+)/$
^community/
^board/ ^$
^board/ ^feeds/(?P<url>.+)/$
^board/ ^show/(?P<category_id>\d+)/$
^board/ ^list_threads/(?P<category_id>\d+)/$
^board/ ^latest/(?P<category_id>\d+)/$
^board/ ^thread/(?P<thread_id>\d+)/$
^board/ ^options/(?P<thread_id>\d+)/$
^board/ ^move/(?P<thread_id>\d+)/$
^board/ ^post/(?P<category_id>\d+)/(?P<post_id>\d+)/$
^board/ ^post/(?P<category_id>\d+)/$
^board/ ^reply/(?P<category_id>\d+)/(?P<thread_id>\d+)/$
^board/ ^annotate/(?P<post_id>\d+)/$
^board/ ^vote/(?P<thread_id>\d+)/$
^board/ ^togglemonitor_(?P<monitortype>\w+)/(?P<object_id>\d+)/$
^board/ ^catchup/(?P<category_id>\d+)/$
^board/ ^poll/(?P<poll_id>\d+)/edit/$
^wiki/
^static/sphene/(.*)$
^site_media/(?P<path>.*)$
^admin/(.*)
The current URL, board/togglemonitor_group//, didn't match any of these.

hmm.. weird. i would guess you haven't configured a Group object. even if you don't intend to use the community Group features (separate forums on the same instance), you have to configure one.. either by adding it to the URL conf, or through the MultiHostMiddleware

so for example if you don't want to use the multi host feature you could use the following includes in your url configuration:

defaultdict = { 'groupName': 'example' }

urlpatterns = patterns('',
# ...

    (r'^community/',  include('sphene.community.urls'), defaultdict),
    (r'^board/',  include('sphene.sphboard.urls'), defaultdict),
    (r'^wiki/',  include('sphene.sphwiki.urls'), defaultdict),

# ...


i hope this makes sense? :) you need to add the 'groupName' to the URL - the GroupMiddleware will do the rest (look it up in the database) - you obviously need a group called 'example' - but this is created automatically through the 'syncdb' usually. so if you haven't deleted/renamed it, it should be there :)
if you get it working with that config, you might want to change the name&co from this default group ..
Hey, we have Signatures !!! Great, isn't it ? ;)

Please login to post a reply.



Powered by Sphene Community Tools