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
...
 
@@ -6,30 +6,32 @@ PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir
 
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
 
BASE_DIR = PACKAGE_ROOT
 

	
 
DEBUG = bool(int(os.environ.get("DEBUG", "1")))
 

	
 
DATABASES = {
 
    "default": {
 
        "ENGINE": "django.db.backends.sqlite3",
 
        "NAME": os.path.join(PROJECT_ROOT, "dev.db"),
 
    }
 
}
 

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

	
 
# HEROKU: Update database configuration with $DATABASE_URL.
 
import dj_database_url
 
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:
 
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
 
# although not all choices may be available on all operating systems.
 
# On Unix systems, a value of None will cause Django to use the same
 
# timezone as the operating system.
 
# If running in a Windows environment this must be set to the same as your
 
# system time zone.
 
TIME_ZONE = os.environ.get("TZ", "America/Los_Angeles")
 

	
 

	
 
# Use SSLRedirectMiddleware
...
 
@@ -123,24 +125,25 @@ TEMPLATES = [
 
]
 

	
 
MIDDLEWARE_CLASSES = [
 
    "django.contrib.sessions.middleware.SessionMiddleware",
 
    "django.middleware.common.CommonMiddleware",
 
    "django.middleware.csrf.CsrfViewMiddleware",
 
    "django.contrib.auth.middleware.AuthenticationMiddleware",
 
    "django.contrib.auth.middleware.SessionAuthenticationMiddleware",
 
    "django.contrib.messages.middleware.MessageMiddleware",
 
    "reversion.middleware.RevisionMiddleware",
 
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
 
    "ssl_redirect.middleware.SSLRedirectMiddleware",
 
    "pinaxcon.middleware.UnprependWWWMiddleware",
 

	
 
]
 

	
 
ROOT_URLCONF = "pinaxcon.urls"
 

	
 
# Python dotted path to the WSGI application used by Django's runserver.
 
WSGI_APPLICATION = "pinaxcon.wsgi.application"
 

	
 
INSTALLED_APPS = [
 
    "django.contrib.admin",
 
    "django.contrib.auth",
 
    "django.contrib.contenttypes",
pinaxcon/templates/static_pages/homepage.html
Show inline comments
...
 
@@ -105,25 +105,25 @@
 
    <div class="container homepage-block-content">
 
      <h1>Sponsors</h1>
 

	
 
      {% load sponsorship_tags %}
 
      {% load thumbnail %}
 

	
 
      {% sponsor_levels as levels %}
 

	
 
      <div class="row sponsor-list">
 
      {% for level in levels %}
 
          {% 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 }}">
 
                              <img src="{% thumbnail sponsor.website_logo '600x360' %}" alt="{{ sponsor.name }}">
 
                          </a>
 
                      {% else %}
 
                          <a href="{{ sponsor.external_url }}" title="{{ sponsor.name }}">{{ sponsor.name }}</a>
 
                      {% endif %}
 
                  </div>
 
              {% endfor %}
 
          {% endif %}
 
      {% endfor %}
 
      </div>
pinaxcon/urls.py
Show inline comments
 
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
 

	
 
import symposion.views
 

	
 

	
 
urlpatterns = [
 
    url(r"^$", TemplateView.as_view(template_name="static_pages/homepage.html"), name="home"),
 

	
 
    # about
 
    url(r"^about/north-bay-python$", TemplateView.as_view(template_name="static_pages/about/north_bay_python.html"), name="about/north-bay-python"),
 
    # TODO add /about/the-mystic
 
    # TODO add /about/petaluma
...
 
@@ -29,26 +31,26 @@ urlpatterns = [
 
    # TODO add /attend/buy-a-ticket
 
    # TODO add /attend/volunteer
 
    # TODO add /attend/financial-assistance
 
    # TODO add /attend/how-to-pitch-your-manager
 
    # TODO add /attend/how-to-get-here
 
    # TODO add /attend/where-to-stay
 
    url(r"^code-of-conduct$", TemplateView.as_view(template_name="static_pages/code_of_conduct/code_of_conduct.html"), name="code-of-conduct"),
 
    url(r"^code-of-conduct/harassment-incidents$", TemplateView.as_view(template_name="static_pages/code_of_conduct/harassment_procedure_attendee.html"), name="code-of-conduct/harassment-incidents"),
 
    url(r"^code-of-conduct/harassment-staff-procedures$", TemplateView.as_view(template_name="static_pages/code_of_conduct/harassment_procedure_staff.html"), name="code-of-conduct/harassment-staff-procedures"),
 
    url(r"^terms-and-conditions$", TemplateView.as_view(template_name="static_pages/terms_and_conditions.html"), name="terms-and-conditions"),
 

	
 
    # 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"),
 

	
 
    # news
 
    url(r"^news$", TemplateView.as_view(template_name="static_pages/news.html"), name="news"),
 

	
 
    # Django, Symposion, and Registrasion URLs
 

	
 
    url(r"^admin/", include(admin.site.urls)),
 

	
 
    url(r"^account/", include("account.urls")),
 

	
 
    url(r"^dashboard/", symposion.views.dashboard, name="dashboard"),
static/scss/custom.scss
Show inline comments
...
 
@@ -103,26 +103,34 @@ body.auth .panel-heading .panel-title span.pull-right {
 
  box-shadow: 0px 0px 2em $background-filter; //, inset 0px -5px 1em rgba(0, 0, 0, 0.8);
 
}
 

	
 
$homepage-block-min-height: 480px;
 

	
 
.homepage-block {
 
  margin-top: 0;
 
  margin-bottom: 0;
 
  min-height: $homepage-block-min-height;
 
  position: relative;
 
  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);
 
}
 

	
 
/* ??? */
 
.homepage-block-footer {
 

	
 
}
 

	
 
.homepage-block.light {
 
  background-color: $background-filter;
 
  z-index: 2;
0 comments (0 inline, 0 general)