Changeset - c929e2fddd46
[Not reviewed]
Merge
0 7 1
Joshua Simmons - 7 years ago 2017-08-16 05:16:16
i@joshuasimmons.name
Merge branch 'master' of github.com:northbaypython/website
5 files changed with 51 insertions and 4 deletions:
0 comments (0 inline, 0 general)
pinaxcon/middleware.py
Show inline comments
 
new file 100644
 
import re
 
import warnings
 

	
 
from django import http
 
from django.conf import settings
 
from django.utils.deprecation import MiddlewareMixin
 

	
 
class UnprependWWWMiddleware(MiddlewareMixin):
 
    """ Unprepends www if necessary. """
 

	
 
    response_redirect_class = http.HttpResponsePermanentRedirect
 

	
 
    def process_request(self, request):
 
        """
 
        Rewrite the URL based on settings.UNPREPEND_WWW
 
        """
 

	
 
        unprepend_www = getattr(settings, "UNPREPEND_WWW", False)
 

	
 
        if not unprepend_www:
 
            return
 

	
 
        # Check for a redirect based on settings.UNPREPEND_WWW
 
        host = request.get_host()
 
        must_unprepend = unprepend_www and host and host.lower().startswith('www.')
 
        wwwless_host = host[4:]
 
        redirect_url = ('%s://%s' % (request.scheme, wwwless_host)) if must_unprepend else ''
 

	
 
        path = request.get_full_path()
 

	
 
        # Return a redirect if necessary
 
        if redirect_url or path != request.get_full_path():
 
            redirect_url += path
 
            return self.response_redirect_class(redirect_url)
pinaxcon/settings.py
Show inline comments
...
 
@@ -16,4 +16,6 @@ DATABASES = {
 
}
 

	
 
UNPREPEND_WWW = bool(os.environ.get("DJANGO_UNPREPEND_WWW", False))
 

	
 
# HEROKU: Update database configuration with $DATABASE_URL.
 
import dj_database_url
...
 
@@ -21,5 +23,5 @@ db_from_env = dj_database_url.config()
 
DATABASES['default'].update(db_from_env)
 

	
 
ALLOWED_HOSTS = ["localhost", ".herokuapp.com", ".northbaypython.org"]
 
ALLOWED_HOSTS = [".localhost", ".herokuapp.com", ".northbaypython.org"]
 

	
 
# Local time zone for this installation. Choices can be found here:
...
 
@@ -133,4 +135,5 @@ MIDDLEWARE_CLASSES = [
 
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
 
    "ssl_redirect.middleware.SSLRedirectMiddleware",
 
    "pinaxcon.middleware.UnprependWWWMiddleware",
 

	
 
]
pinaxcon/templates/static_pages/homepage.html
Show inline comments
...
 
@@ -115,5 +115,5 @@
 
          {% if level.sponsors %}
 
              {% for sponsor in level.sponsors %}
 
                  <div class="col-md-3">
 
                  <div class="sponsor">
 
                      {% if sponsor.website_logo %}
 
                          <a href="{{ sponsor.external_url }}" title="{{ sponsor.name }}">
pinaxcon/urls.py
Show inline comments
...
 
@@ -2,7 +2,9 @@ from django.conf import settings
 
from django.conf.urls import include, url
 
from django.conf.urls.static import static
 
from django.contrib.staticfiles.templatetags.staticfiles import static as _static
 
from django.views.generic import TemplateView
 
from django.views.generic import RedirectView
 

	
 

	
 
from django.contrib import admin
 

	
...
 
@@ -39,6 +41,6 @@ urlpatterns = [
 

	
 
    # sponsor
 
    url(r"^sponsors/prospectus$", RedirectView.as_view(url="/static/assets/northbaypython_prospectus.pdf"), name="sponsors/prospectus"),
 
    url(r"^northbaypython_prospectus.pdf$", RedirectView.as_view(url="/static/assets/northbaypython_prospectus.pdf"), name="northbaypython_prospectus.pdf"),
 
    url(r"^sponsors/prospectus$", RedirectView.as_view(url=_static("assets/northbaypython_prospectus.pdf")), name="sponsors/prospectus"),
 
    url(r"^northbaypython_prospectus.pdf$", RedirectView.as_view(url=_static("assets/northbaypython_prospectus.pdf")), name="northbaypython_prospectus.pdf"),
 
    url(r"^sponsors/become-a-sponsor$", TemplateView.as_view(template_name="static_pages/sponsors/become_a_sponsor.html"), name="sponsors/become-a-sponsor"),
 

	
static/scss/custom.scss
Show inline comments
...
 
@@ -113,6 +113,14 @@ $homepage-block-min-height: 480px;
 
  box-shadow: $box-shadow;
 
  z-index: 3;
 

	
 
  .sponsor {
 
    @include make-xs-column(6);
 
    @include make-sm-column(4);
 
    @include make-md-column(3);
 
    max-width: 600px;
 
  }
 
}
 

	
 

	
 
.homepage-block-content {
 
  min-height: ($homepage-block-min-height - 80px);
0 comments (0 inline, 0 general)