summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appstore/settings.py2
-rw-r--r--appstore/urls.py17
-rw-r--r--store/api.py7
3 files changed, 20 insertions, 6 deletions
diff --git a/appstore/settings.py b/appstore/settings.py
index 83ca6d7..377843a 100644
--- a/appstore/settings.py
+++ b/appstore/settings.py
@@ -122,6 +122,8 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
+URL_PREFIX = '' # Shouldn't start with '/' in case it is used
+
STATIC_URL = '/static/'
# Absolute path to the directory that holds media.
diff --git a/appstore/urls.py b/appstore/urls.py
index 5e4e708..081acf9 100644
--- a/appstore/urls.py
+++ b/appstore/urls.py
@@ -31,12 +31,9 @@
from django.conf.urls import patterns, include, url
from django.contrib import admin
+import settings
-urlpatterns = patterns('',
- # Examples:
- # url(r'^$', 'appstore.views.home', name='home'),
- # url(r'^blog/', include('blog.urls')),
-
+base_urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^hello$', 'store.api.hello'),
@@ -50,3 +47,13 @@ urlpatterns = patterns('',
url(r'^category/list$', 'store.api.categoryList'),
url(r'^category/icon$', 'store.api.categoryIcon'),
)
+
+
+prefix = '^'
+if settings.URL_PREFIX !='':
+ prefix = prefix + settings.URL_PREFIX + '/'
+
+urlpatterns = patterns('',
+ url(prefix, include(base_urlpatterns)),
+)
+
diff --git a/store/api.py b/store/api.py
index 5656857..9734f6e 100644
--- a/store/api.py
+++ b/store/api.py
@@ -224,8 +224,13 @@ def appPurchase(request):
else:
shutil.copyfile(fromFilePath, toPath + toFile)
+ if settings.URL_PREFIX != '':
+ downloadUri = '/' + settings.URL_PREFIX + '/app/download/' + toFile
+ else:
+ downloadUri = '/app/download/' + toFile
+
return JsonResponse({'status': 'ok',
- 'url': request.build_absolute_uri('/app/download/' + toFile),
+ 'url': request.build_absolute_uri(downloadUri),
'expiresIn': int(settings.APPSTORE_DOWNLOAD_EXPIRY) * 60})
# a cronjob runing "manage.py expiredownloads" every settings.APPSTORE_DOWNLOAD_EXPIRY/2