Commit 02298a0b authored by eric's avatar eric

Allow the website to work under a subfolder i.e. http://relearn.be/2015/

parent b925c95a
......@@ -21,3 +21,6 @@ EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = True
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
from django.contrib import admin
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'^all/$', TemplateView.as_view(template_name = 'all.html'), name='all'),
......@@ -29,3 +40,6 @@ urlpatterns = patterns(
url(r'w/(?P<slug>[^/]+)$', 'relearn.views.pad', name='pad-write'),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns = patterns('',
url(r'^' + settings.SUBFOLDER + '/' , include(base_urlpatterns)),
)
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