Commit 60e1e3bc authored by svilayphiou's avatar svilayphiou

merge

parents 17cc9eca a635fded
...@@ -21,3 +21,6 @@ EMAIL_HOST_PASSWORD = '' ...@@ -21,3 +21,6 @@ EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = True EMAIL_USE_TLS = True
HOME_PAD = 'About.md' HOME_PAD = 'About.md'
# You can use this if you want to run the project under a subfolder
# SUBFOLDER = '2015'
\ No newline at end of file
...@@ -9,7 +9,18 @@ from django.conf.urls.static import static ...@@ -9,7 +9,18 @@ from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns( # This is to allow the website to work under a subfolder
# i.e. http://relearn.be/2015/
# Define SUBFOLDER in your local_settings.py
BASE_URL = '^'
try:
BASE_URL = r'^' + settings.SUBFOLDER
if BASE_URL and not BASE_URL.endswith(r'/'):
BASE_URL += r'/'
except AttributeError:
pass
base_urlpatterns = patterns(
'', '',
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^all/$', TemplateView.as_view(template_name = 'all.html'), name='all'), url(r'^all/$', TemplateView.as_view(template_name = 'all.html'), name='all'),
...@@ -29,3 +40,6 @@ urlpatterns = patterns( ...@@ -29,3 +40,6 @@ urlpatterns = patterns(
url(r'w/(?P<slug>[^/]+)$', 'relearn.views.pad', name='pad-write'), url(r'w/(?P<slug>[^/]+)$', 'relearn.views.pad', name='pad-write'),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns = patterns('',
url(BASE_URL , include(base_urlpatterns)),
)
...@@ -279,7 +279,7 @@ def pad_read(request, mode="r", slug=None): ...@@ -279,7 +279,7 @@ def pad_read(request, mode="r", slug=None):
# One needs to set the ‘Static’ metadata to ‘Public’ for the page to be accessible to outside visitors # One needs to set the ‘Static’ metadata to ‘Public’ for the page to be accessible to outside visitors
if not meta or not 'status' in meta or not meta['status'][0] or not meta['status'][0].lower() in ['public']: if not meta or not 'status' in meta or not meta['status'][0] or not meta['status'][0].lower() in ['public']:
if not request.user.is_authenticated(): if not request.user.is_authenticated():
raise PermissionDenied pass #raise PermissionDenied
if meta and len(meta.keys()) > 0: if meta and len(meta.keys()) > 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment