Static templates.

master
Nick Sergeant 2014-10-20 22:26:51 -04:00
parent 1e1c0d40be
commit 4f43f294e4
2 changed files with 8 additions and 9 deletions

View File

@ -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'),
)

View File

@ -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<path>.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__), 'media')}),
)