Added landing app with custom middleware
This commit is contained in:
parent
5d65a6ecff
commit
7121ca80d9
|
@ -9,12 +9,12 @@ module.exports = (grunt) ->
|
|||
compress: true
|
||||
development:
|
||||
files:
|
||||
"shelfzilla/themes/default/static/css/style.css": "shelfzilla/themes/default/static/less/style.less"
|
||||
"shelfzilla/themes/bootflat/static/css/style.css": "shelfzilla/themes/bootflat/static/less/style.less"
|
||||
|
||||
coffee:
|
||||
development:
|
||||
files:
|
||||
'shelfzilla/themes/default/static/js/main.full.js': 'shelfzilla/themes/default/static/coffee/main.coffee'
|
||||
'shelfzilla/themes/bootflat/static/js/main.full.js': 'shelfzilla/themes/bootflat/static/coffee/main.coffee'
|
||||
|
||||
|
||||
concat:
|
||||
|
@ -22,42 +22,41 @@ module.exports = (grunt) ->
|
|||
separator: ';'
|
||||
base:
|
||||
src: [
|
||||
"shelfzilla/themes/default/static/js/main.full.js",
|
||||
"shelfzilla/themes/bootflat/static/js/main.full.js",
|
||||
]
|
||||
dest: "shelfzilla/themes/default/static/js/site.js"
|
||||
dest: "shelfzilla/themes/bootflat/static/js/site.js"
|
||||
|
||||
uglify:
|
||||
development:
|
||||
files:
|
||||
'shelfzilla/themes/default/static/js/site.js': 'shelfzilla/themes/default/static/js/site.js'
|
||||
'shelfzilla/themes/bootflat/static/js/site.js': 'shelfzilla/themes/bootflat/static/js/site.js'
|
||||
|
||||
clean:
|
||||
development:
|
||||
src: [
|
||||
"shelfzilla/themes/default/static/js/*.full.js",
|
||||
"shelfzilla/themes/bootflat/static/js/*.full.js",
|
||||
]
|
||||
production:
|
||||
src: [
|
||||
"shelfzilla/themes/default/static/js/*.full.js",
|
||||
"shelfzilla/themes/bootflat/static/js/*.full.js",
|
||||
]
|
||||
release:
|
||||
src: [
|
||||
"shelfzilla/themes/default/static/less",
|
||||
"shelfzilla/themes/default/static/coffee",
|
||||
"shelfzilla/themes/default/static/libs/kube*",
|
||||
"shelfzilla/themes/bootflat/static/less",
|
||||
"shelfzilla/themes/bootflat/static/coffee",
|
||||
]
|
||||
|
||||
watch:
|
||||
options:
|
||||
livereload: true
|
||||
layout:
|
||||
files: ['shelfzilla/themes/default/templates/**/*.html', 'shelfzilla/themes/default/templates/**/*.jinja']
|
||||
files: ['shelfzilla/themes/bootflat/templates/**/*.html', 'shelfzilla/themes/bootflat/templates/**/*.jinja']
|
||||
tasks: []
|
||||
less:
|
||||
files: ['shelfzilla/themes/default/static/less/*.less']
|
||||
files: ['shelfzilla/themes/bootflat/static/less/*.less']
|
||||
tasks: ['less']
|
||||
coffee:
|
||||
files: ['shelfzilla/themes/default/static/coffee/*.coffee']
|
||||
files: ['shelfzilla/themes/bootflat/static/coffee/*.coffee']
|
||||
tasks: ['coffee', 'concat', 'clean:development']
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# Django, be happy.
|
|
@ -0,0 +1,8 @@
|
|||
from django.conf.urls import patterns, url
|
||||
|
||||
from .views import LandingView
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^landing/$', LandingView.as_view()),
|
||||
)
|
|
@ -0,0 +1,11 @@
|
|||
from django.views.generic import View
|
||||
from django.template import RequestContext
|
||||
from django.shortcuts import render_to_response
|
||||
|
||||
|
||||
class LandingView(View):
|
||||
template = 'landing/landing.html'
|
||||
|
||||
def get(self, request):
|
||||
ctx = RequestContext(request, {})
|
||||
return render_to_response(self.template, context_instance=ctx)
|
|
@ -0,0 +1,13 @@
|
|||
from django.http import HttpResponseRedirect
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class BetaMiddleware(object):
|
||||
"""
|
||||
Allow access only to people on the Beta group.
|
||||
"""
|
||||
def process_request(self, request):
|
||||
beta_group_id = settings.BETA_ACCESS_GROUP_ID
|
||||
if request.user and not request.user.groups.filter(pk=beta_group_id):
|
||||
if request.path not in settings.BETA_ACCESS_ALLOW_URLS:
|
||||
return HttpResponseRedirect('/landing/')
|
|
@ -49,8 +49,8 @@ INSTALLED_APPS = (
|
|||
'south',
|
||||
|
||||
# Apps
|
||||
'shelfzilla.apps.landing',
|
||||
'shelfzilla.apps.manga',
|
||||
|
||||
)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
|
@ -72,11 +72,13 @@ MIDDLEWARE_CLASSES = (
|
|||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
|
||||
'shelfzilla.middleware.BetaMiddleware',
|
||||
)
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
os.path.join(BASE_DIR, "themes", "_base"),
|
||||
os.path.join(BASE_DIR, "themes", "bootflat"),
|
||||
os.path.join(BASE_DIR, "themes", "bootflat", "templates"),
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'shelfzilla.urls'
|
||||
|
@ -115,3 +117,10 @@ STATIC_URL = '/static/'
|
|||
|
||||
# Max username length (longerusername)
|
||||
MAX_USERNAME_LENGTH = 75
|
||||
|
||||
# Beta settings
|
||||
BETA_ACCESS_GROUP_ID = 1
|
||||
BETA_ACCESS_ALLOW_URLS = (
|
||||
'/landing/',
|
||||
'/login/',
|
||||
)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{% block page_title %}{% endblock %}</title>
|
||||
{% block extra_css %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block main_content %}{% endblock %}
|
||||
{% block extra_js %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,5 @@
|
|||
{% extends "_layout.html" %}
|
||||
|
||||
{% block main_content %}
|
||||
Landing
|
||||
{% endblock %}
|
|
@ -3,10 +3,8 @@ from django.conf.urls import patterns, include, url
|
|||
from django.contrib import admin
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
# Examples:
|
||||
# url(r'^$', 'shelfzilla.views.home', name='home'),
|
||||
# url(r'^blog/', include('blog.urls')),
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^', include('shelfzilla.apps.landing.urls')),
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
|
|
Reference in New Issue