diff --git a/settings.py b/settings.py index e048a82..d16c349 100644 --- a/settings.py +++ b/settings.py @@ -44,7 +44,6 @@ ADMINS = (('Nick Sergeant', 'nick@snipt.net'),) ALLOWED_HOSTS = ['*'] AUTH_PROFILE_MODULE = 'accounts.UserProfile' AUTHENTICATION_BACKENDS = ('utils.backends.EmailOrUsernameModelBackend',) -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) BASE_PATH = os.path.dirname(__file__) CSRF_COOKIE_DOMAIN = '.snipt.net' CSRF_COOKIE_SECURE = True if 'USE_SSL' in os.environ else False @@ -73,6 +72,10 @@ SERVER_EMAIL = 'support@snipt.net' SESSION_COOKIE_AGE = 15801100 SESSION_COOKIE_SECURE = True if 'USE_SSL' in os.environ else False SITE_ID = 1 +STATICFILES_DIRS = (os.path.join(BASE_PATH, 'media'),) +STATICFILES_FINDERS = ('django.contrib.staticfiles.finders.FileSystemFinder','django.contrib.staticfiles.finders.AppDirectoriesFinder',) +STATIC_ROOT = os.path.join(BASE_PATH, 'static') +STATIC_URL = 'https://snipt.s3.amazonaws.com/' TASTYPIE_CANNED_ERROR = "There was an error with your request. The site developers have a record of this error, please email api@snipt.net and we'll help you out." TEMPLATE_DIRS = (os.path.join(PROJECT_PATH, 'templates'),) TEMPLATE_DEBUG = DEBUG @@ -82,14 +85,10 @@ USE_I18N = True USE_L10N = True USE_TZ = True -if DEBUG: - STATICFILES_DIRS = (os.path.join(BASE_PATH, 'media'),) - STATICFILES_FINDERS = ('django.contrib.staticfiles.finders.FileSystemFinder','django.contrib.staticfiles.finders.AppDirectoriesFinder',) - STATIC_ROOT = os.path.join(BASE_PATH, 'static') - STATIC_URL = '/static/' -else: - STATIC_URL = 'https://snipt.s3.amazonaws.com/' +if 'USE_SSL' in os.environ: + BASE_DIR = os.path.dirname(os.path.abspath(__file__)) STATIC_ROOT = 'staticfiles' + STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) diff --git a/urls.py b/urls.py index 8885a4f..d5e75e3 100644 --- a/urls.py +++ b/urls.py @@ -68,7 +68,7 @@ urlpatterns = patterns('', url(r'^', include('snipts.urls')), ) -if settings.DEBUG: +if 'USE_SSL' not in os.environ: urlpatterns += patterns('', (r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__), 'media')}), )