Add admin staticfiles

Add rna dependencies and ConditionalAuthMiddleware

Add/update rna, django-pagedown

Add ConditionalAuthMiddleware, rna url

Add django-filter and settings.REST_FRAMEWORK

Add collectstatic to update_assets

Remove ctx param from base_update_assets

Clear *.pyc during deploy and move collectstatic

Add rna and api-token-auth PT
This commit is contained in:
Josh Mize 2014-09-09 02:08:38 -05:00
Родитель 80488192c3
Коммит e2c2c79fc3
11 изменённых файлов: 84 добавлений и 21 удалений

6
.gitmodules поставляемый
Просмотреть файл

@ -55,3 +55,9 @@
[submodule "vendor-local/src/chkcrontab"]
path = vendor-local/src/chkcrontab
url = git://github.com/lyda/chkcrontab.git
[submodule "vendor-local/src/django-pagedown"]
path = vendor-local/src/django-pagedown
url = https://github.com/timmyomahony/django-pagedown.git
[submodule "vendor-local/src/django-filter"]
path = vendor-local/src/django-filter
url = https://github.com/alex/django-filter.git

Просмотреть файл

@ -6,9 +6,19 @@ import datetime
from email.utils import formatdate
import time
from django.conf import settings
from django.contrib.auth.middleware import AuthenticationMiddleware
from django_statsd.middleware import GraphiteRequestTimingMiddleware
class ConditionalAuthMiddleware(object):
def process_request(self, request):
if any(request.path.startswith(prefix)
for prefix in settings.AUTHENTICATED_URL_PREFIXES):
AuthenticationMiddleware().process_request(request)
class CacheMiddleware(object):
def process_response(self, request, response):

Просмотреть файл

@ -63,12 +63,14 @@ DOTLANG_FILES = ['main', 'download_button', 'newsletter']
# matches the first url component (e.g. mozilla.org/gameon/)
SUPPORTED_NONLOCALES += [
# from redirects.urls
'admin',
'contribute.json',
'credits',
'gameon',
'rna',
'robots.txt',
'telemetry',
'webmaker',
'gameon',
'robots.txt',
'credits',
'contribute.json',
]
ALLOWED_HOSTS = [
@ -102,7 +104,12 @@ def JINJA_CONFIG():
'auto_reload': True,
}
STATIC_URL = '/static/'
STATIC_ROOT = path('static')
JINGO_MINIFY_USE_STATIC = False
JINGO_EXCLUDE_APPS = (
'admin', 'registration', 'rest_framework', 'rna', 'waffle')
CACHEBUST_IMGS = False
# Bundles is a dictionary of two dictionaries, css and js, which list css files
@ -1049,24 +1056,29 @@ MIDDLEWARE_CLASSES = (
'bedrock.mozorg.middleware.CacheMiddleware',
'dnt.middleware.DoNotTrackMiddleware',
'lib.l10n_utils.middleware.FixLangFileTranslationsMiddleware',
'bedrock.mozorg.middleware.ConditionalAuthMiddleware',
))
AUTHENTICATED_URL_PREFIXES = ('/admin/', '/rna/')
INSTALLED_APPS = get_apps(exclude=(
'compressor',
'django_browserid',
'django.contrib.sessions',
'django.contrib.staticfiles',
'session_csrf',
'djcelery',
), append=(
# Local apps
# third-party apps
'jingo_markdown',
'jingo_minify',
'django_statsd',
'pagedown',
'rest_framework',
'waffle',
'south',
# Django contrib apps
'django.contrib.admin',
'django_sha2', # Load after auth to monkey-patch it.
'django.contrib.contenttypes',
'django.contrib.messages',
@ -1102,6 +1114,8 @@ INSTALLED_APPS = get_apps(exclude=(
'rna',
))
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
LOCALE_PATHS = (
path('locale'),
)
@ -1426,3 +1440,24 @@ LOGGING = {
},
},
}
PASSWORD_HASHERS = ['django.contrib.auth.hashers.PBKDF2PasswordHasher']
REST_FRAMEWORK = {
# Use hyperlinked styles by default.
# Only used if the `serializer_class` attribute is not set on a view.
'DEFAULT_MODEL_SERIALIZER_CLASS':
'rna.serializers.HyperlinkedModelSerializerWithPkField',
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
),
'DEFAULT_FILTER_BACKENDS': ('rna.filters.TimestampedFilterBackend',)
}

Просмотреть файл

@ -4,15 +4,13 @@
from django.conf import settings
from django.conf.urls import handler404, include, patterns
from django.contrib import admin
from funfactory.monkeypatches import patch
patch()
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
admin.autodiscover()
# The default django 500 handler doesn't run the ContextProcessors, which breaks
# the base template page. So we replace it with one that does!
@ -21,6 +19,9 @@ handler500 = 'lib.bedrock_util.server_error_view'
urlpatterns = patterns(
'',
# authenticated urls
(r'^admin/', include(admin.site.urls)),
(r'^rna/', include('rna.urls')),
# Main pages
(r'^lightbeam/', include('bedrock.lightbeam.urls')),
(r'^foundation/', include('bedrock.foundation.urls')),
@ -52,9 +53,6 @@ urlpatterns = patterns(
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
)
# In DEBUG mode, serve media files through Django.

Просмотреть файл

@ -39,6 +39,7 @@ def update_code(ctx, tag):
ctx.local("git checkout -f %s" % tag)
ctx.local("git submodule sync")
ctx.local("git submodule update --init --recursive")
ctx.local("find . -name '*.pyc' -delete")
@task
@ -52,6 +53,7 @@ def update_assets(ctx):
management_cmd(ctx, 'compress_assets')
management_cmd(ctx, 'update_product_details')
management_cmd(ctx, 'update_externalfiles')
management_cmd(ctx, 'collectstatic --noinput')
@task

Просмотреть файл

@ -135,6 +135,10 @@ RewriteRule ^/ja/firefox/organizations/?$ http://www.mozilla.jp/business/downloa
## Redirect things to django!
# bug 1044184
RewriteRule ^/admin(/.*)?$ /b/admin$1 [PT]
RewriteRule ^/rna(/.*)?$ /b/rna$1 [PT]
# bug 797192, 892470
RewriteRule ^/(\w{2,3}(?:-\w{2})?/)?plugincheck(/?)$ /b/$1/plugincheck$2 [PT]

4
static/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

@ -0,0 +1 @@
Subproject commit e58e15ebf27e90cc0d47b7e58a2181e9150c49ab

@ -0,0 +1 @@
Subproject commit 78556863faa5654f749c5562b390317c6cad10b3

@ -1 +1 @@
Subproject commit 3122af9692d93e720ff4f2cdffdd341869756840
Subproject commit 47771c3aed24ff2c284b7fee83fe7dbc2cbb6b6a

Просмотреть файл

@ -3,23 +3,25 @@ packages/certifi
packages/chardet
packages/python-memcached
packages/pytz
src/basket-client
packages/PyYAML/lib
src/feedparser/feedparser
src/basket-client
src/chkcrontab
src/django-dnt
src/django-extensions
src/django-filter
src/django-pagedown
src/django-recaptcha
src/django-rest-framework
src/django-dnt
src/django-statsd
src/django-waffle
src/feedparser/feedparser
src/icalendar/src
src/jingo-markdown
src/legal-docs
src/mdx_outline
src/pystatsd
src/Python-Markdown
src/requests
src/rna
src/six
src/tweepy
src/mdx_outline
src/legal-docs
src/icalendar/src
src/chkcrontab