Merge pull request #1 from tjsga/rewrite

Move django to production
This commit is contained in:
William Zhang 2018-06-03 17:21:28 -04:00 committed by GitHub
commit 10d0b794c3
83 changed files with 446 additions and 237 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
source /var/www/sgawebsite/env/bin/activate

26
.gitignore vendored
View File

@ -1,5 +1,21 @@
_site .DS_Store
.sass-cache *.pyc
.jekyll-metadata *.pyo
Gemfile.lock env
gems/ env*
dist
build
*.egg
*.egg-info
_mailinglist
.tox
.cache/
.idea/
__pycache__/
migrations/
config.py
settings.py
env/
db.sqlite3
*.json
admin/

29
Gemfile
View File

@ -1,29 +0,0 @@
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "3.5.2"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"
gem "hash-joiner", "~> 0.0.7"
gem "json", "~> 2.1.0"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.6"
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

View File

@ -1,10 +0,0 @@
---
# Jekyll layout that compresses HTML
# v3.0.2
# http://jch.penibelst.de/
# © 20142015 Anatol Broder
# MIT License
---
{% capture _LINE_FEED %}
{% endcapture %}{% if site.compress_html.ignore.envs contains jekyll.environment %}{{ content }}{% else %}{% capture _content %}{{ content }}{% endcapture %}{% assign _profile = site.compress_html.profile %}{% if site.compress_html.endings == "all" %}{% assign _endings = "html head body li dt dd p rt rp optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% else %}{% assign _endings = site.compress_html.endings %}{% endif %}{% for _element in _endings %}{% capture _end %}</{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _end %}{% endfor %}{% if _profile and _endings %}{% assign _profile_endings = _content | size | plus: 1 %}{% endif %}{% for _element in site.compress_html.startings %}{% capture _start %}<{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _start %}{% endfor %}{% if _profile and site.compress_html.startings %}{% assign _profile_startings = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.comments == "all" %}{% assign _comments = "<!-- -->" | split: " " %}{% else %}{% assign _comments = site.compress_html.comments %}{% endif %}{% if _comments.size == 2 %}{% capture _comment_befores %}.{{ _content }}{% endcapture %}{% assign _comment_befores = _comment_befores | split: _comments.first %}{% for _comment_before in _comment_befores %}{% if forloop.first %}{% continue %}{% endif %}{% capture _comment_outside %}{% if _carry %}{{ _comments.first }}{% endif %}{{ _comment_before }}{% endcapture %}{% capture _comment %}{% unless _carry %}{{ _comments.first }}{% endunless %}{{ _comment_outside | split: _comments.last | first }}{% if _comment_outside contains _comments.last %}{{ _comments.last }}{% assign _carry = false %}{% else %}{% assign _carry = true %}{% endif %}{% endcapture %}{% assign _content = _content | remove_first: _comment %}{% endfor %}{% if _profile %}{% assign _profile_comments = _content | size | plus: 1 %}{% endif %}{% endif %}{% assign _pre_befores = _content | split: "<pre" %}{% assign _content = "" %}{% for _pre_before in _pre_befores %}{% assign _pres = _pre_before | split: "</pre>" %}{% assign _pres_after = "" %}{% if _pres.size != 0 %}{% if site.compress_html.blanklines %}{% assign _lines = _pres.last | split: _LINE_FEED %}{% capture _pres_after %}{% for _line in _lines %}{% assign _trimmed = _line | split: " " | join: " " %}{% if _trimmed != empty or forloop.last %}{% unless forloop.first %}{{ _LINE_FEED }}{% endunless %}{{ _line }}{% endif %}{% endfor %}{% endcapture %}{% else %}{% assign _pres_after = _pres.last | split: " " | join: " " %}{% endif %}{% endif %}{% capture _content %}{{ _content }}{% if _pre_before contains "</pre>" %}<pre{{ _pres.first }}</pre>{% endif %}{% unless _pre_before contains "</pre>" and _pres.size == 1 %}{{ _pres_after }}{% endunless %}{% endcapture %}{% endfor %}{% if _profile %}{% assign _profile_collapse = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.clippings == "all" %}{% assign _clippings = "html head title base link meta style body article section nav aside h1 h2 h3 h4 h5 h6 hgroup header footer address p hr blockquote ol ul li dl dt dd figure figcaption main div table caption colgroup col tbody thead tfoot tr td th" | split: " " %}{% else %}{% assign _clippings = site.compress_html.clippings %}{% endif %}{% for _element in _clippings %}{% assign _edges = " <e;<e; </e>;</e>;</e> ;</e>" | replace: "e", _element | split: ";" %}{% assign _content = _content | replace: _edges[0], _edges[1] | replace: _edges[2], _edges[3] | replace: _edges[4], _edges[5] %}{% endfor %}{% if _profile and _clippings %}{% assign _profile_clippings = _content | size | plus: 1 %}{% endif %}{{ _content }}{% if _profile %} <table id="compress_html_profile_{{ site.time | date: "%Y%m%d" }}" class="compress_html_profile"> <thead> <tr> <td>Step <td>Bytes <tbody> <tr> <td>raw <td>{{ content | size }}{% if _profile_endings %} <tr> <td>endings <td>{{ _profile_endings }}{% endif %}{% if _profile_startings %} <tr> <td>startings <td>{{ _profile_startings }}{% endif %}{% if _profile_comments %} <tr> <td>comments <td>{{ _profile_comments }}{% endif %}{% if _profile_collapse %} <tr> <td>collapse <td>{{ _profile_collapse }}{% endif %}{% if _profile_clippings %} <tr> <td>clippings <td>{{ _profile_clippings }}{% endif %} </table>{% endif %}{% endif %}

View File

@ -1,23 +0,0 @@
module Jekyll
class FileExistsTag < Liquid::Tag
def initialize(tag_name, path, tokens)
super
@path = path
end
def render(context)
# Pipe parameter through Liquid to make additional replacements possible
url = Liquid::Template.parse(@path).render context
# Adds the site source, so that it also works with a custom one
site_source = context.registers[:site].config['source']
file_path = site_source + '/' + url
# Check if file exists (returns true or false)
"#{File.exist?(file_path.strip!)}"
end
end
end
Liquid::Template.register_tag('file_exists', Jekyll::FileExistsTag)

View File

@ -1,40 +0,0 @@
require 'json'
require 'hash-joiner'
require 'open-uri'
module Jekyll_Get
class Generator < Jekyll::Generator
safe true
priority :highest
def generate(site)
config = site.config['jekyll_get']
if !config
return
end
if !config.kind_of?(Array)
config = [config]
end
config.each do |d|
begin
target = site.data[d['data']]
source = JSON.load(open(d['json']))
if target
HashJoiner.deep_merge target, source
else
site.data[d['data']] = source
end
if d['cache']
data_source = (site.config['data_source'] || '_data')
path = "#{data_source}/#{d['data']}.json"
open(path, 'wb') do |file|
file << JSON.generate(site.data[d['data']])
end
end
rescue
next
end
end
end
end
end

View File

@ -1,25 +0,0 @@
---
layout: post
title: "Welcome to Jekyll!"
date: 2017-09-04 13:44:53 -0400
categories: jekyll update
---
Youll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated.
To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
Jekyll also offers powerful support for code snippets:
{% highlight ruby %}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}
Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekylls GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk].
[jekyll-docs]: https://jekyllrb.com/docs/home
[jekyll-gh]: https://github.com/jekyll/jekyll
[jekyll-talk]: https://talk.jekyllrb.com/

View File

@ -1,73 +0,0 @@
---
layout: compress
permalink: /about
orgs: ["officers", "excomm", "senators", "sponsors"]
---
<!DOCTYPE html>
<html>
<head>
<link href="css/about.css" rel="stylesheet" />
{% include head.html %}
<title>About - TJSGA</title>
</head>
<body>
{% include header.html %}
<div id="wrapper" class="fluid">
<section id="contact">
<h2>Contact Us!</h2>
<div class="desc">
<span class="quote">
"The world is moved not only by the mighty shoves of the heroes, but also by the aggregate of the tiny pushes of each honest worker." - Helen Keller
</span>
</div>
<div class="desc">
Contact us at
<a href="mailto:sga.tjhsst@gmail.com">sga.tjhsst@gmail.com</a>. We would love to answer questions or hear
about how you think we can improve TJ!
</div>
</section>
<hr />
{% for org in site.data.about %}
<section id="{{ org['username'] }}">
<h2>{{ org['name'] }}</h2>
{% for member in org.members %}
<div class="{{ org.username }}-intro">
{% assign year = member.year | downcase %}
{% assign first = member.first | slice: 0 %}
{% assign last = member.last | slice: 0,7 %}
{% if org['username'] != "sponsors" %}
{% capture filename %}img/people/{{ year }}{{ first }}{{ last }}.jpg{% endcapture %}
{% else %}
{% capture filename %}img/people/{{ first }}{{ last }}.jpg{% endcapture %}
{% endif %}
{% capture exists %}
{% file_exists {{ path }} %}
{% endcapture %}
{% if exists == false %}
{% capture filename %}img/profile.jpg{% endcapture %}
{% endif %}
<div class="{{ org.username }}-image">
<img src="{{ filename | strip_newlines | downcase }}" />
</div>
<div class="{{ org.username }}-text">
<span>{{ member.first }} {{ member.last }}</span>
{% if org['username'] != "sponsors" and org['username'] != "senators" %}
<span>{{ year }}</span>
{% endif %}
{% if org['username'] != "officers" %}
<span>{{ member.title }}</span>
{% endif %}
{% if org['username'] == "officers" %}
<p>{{ member.intro }}</p>
{% endif %}
</div>
</div>
{% endfor %}
</section>
{% endfor %}
</div>
{% include footer.html %}
</body>
</html>

22
manage.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sgawebsite.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)

7
requirements.txt Normal file
View File

@ -0,0 +1,7 @@
certifi==2018.4.16
chardet==3.0.4
Django==2.0.5
idna==2.6
pytz==2018.4
requests==2.18.4
urllib3==1.22

3
run.sh
View File

@ -6,6 +6,5 @@
#/web/activities/ghs/public/env/bin/python run.py $PORT #/web/activities/ghs/public/env/bin/python run.py $PORT
#export PATH=$PATH:/home/2018wzhang/.gem/ruby/2.3.0/bin; #export PATH=$PATH:/home/2018wzhang/.gem/ruby/2.3.0/bin;
#/home/2018wzhang/.gem/ruby/2.3.0/bin/bundler exec jekyll serve --port $PORT #/home/2018wzhang/.gem/ruby/2.3.0/bin/bundler exec jekyll serve --port $PORT
bundle exec jekyll serve --port $PORT /web/activities/sga/sgawebsite/manage.py runserver $PORT
#/web/activities/ghs/public/env/bin/python /web/activities/ghs/public/ghswebsite/app.py $PORT #/web/activities/ghs/public/env/bin/python /web/activities/ghs/public/ghswebsite/app.py $PORT

0
sgawebsite/__init__.py Normal file
View File

View File

View File

View File

@ -0,0 +1,14 @@
from django.contrib import admin
from .models import Member, Resource
'''
class MemberAdmin(admin.ModelAdmin):
list_display = ('name', 'display')
class ResourceAdmin(admin.ModelAdmin):
list_display = ('name', 'display')
'''
admin.site.register(Member)
admin.site.register(Resource)

View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class MainConfig(AppConfig):
name = 'main'

View File

@ -0,0 +1,29 @@
from django.db import models
# Create your models here.
class Member(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
year = models.IntegerField(blank=True, default=-1)
intro = models.CharField(max_length=140, blank=True, default='')
title = models.CharField(max_length=30, blank=True, default='')
CATEGORIES = (('officers', 'Officers'), ('excomm', 'Executive Committee'),
('senators', 'Class Senators'), ('sponsors', 'Sponsors'))
category = models.CharField(max_length=10, choices=CATEGORIES)
def __str__(self):
return self.first_name + ' ' + self.last_name
class Resource(models.Model):
name = models.CharField(max_length=50)
link = models.URLField()
text = models.CharField(max_length=140)
CATEGORIES = (('general', 'General Resources'),
('event', 'Event Resources'))
category = models.CharField(max_length=1, choices=CATEGORIES)
def __str__(self):
return self.name

View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@ -0,0 +1,11 @@
from django.conf.urls import url
from .views import *
urlpatterns = [
url(r'^$', index, name='index'),
url(r'about', about, name='about'),
url(r'resources', resources, name='resources'),
url(r'events', events, name='events'),
]

View File

@ -0,0 +1,59 @@
from django.shortcuts import render
from django.template.defaulttags import register
from .models import Member, Resource
from django.contrib.staticfiles.storage import staticfiles_storage
import os
def index(request):
return render(request, 'index.html')
def about(request):
categories = list(Member.CATEGORIES)
orgs = [c[0] for c in list(Member.CATEGORIES)]
data = dict()
context = dict()
for c in categories:
data[c[0]] = Member.objects.filter(category=c[0])
print(categories)
context['categories'] = categories
context['orgs'] = orgs
context['data'] = data
return render(request, 'about.html', context)
@register.filter
def get_item(dictionary, key):
return dictionary.get(key)
@register.filter
def username(obj):
if obj.first_name and obj.last_name:
if obj.year > 0:
return str(str(obj.year) +
obj.first_name[:1] +
obj.last_name[:7]).lower()
else:
return str(obj.first_name[:1] + obj.last_name[:7]).lower()
return None
@register.filter
def filename(obj):
uname = username(obj)
folder = 'img'
filepath = os.path.join(folder, 'people', uname + '.jpg')
if uname is not None and staticfiles_storage.exists(filepath):
return os.path.join('static', filepath)
else:
return os.path.join('static', folder, 'profile.jpg')
def resources(request):
return render(request, 'resources.html')
def events(request):
return render(request, 'events.html')

View File

@ -0,0 +1,127 @@
"""
Django settings for sgawebsite project.
Generated by 'django-admin startproject' using Django 1.11.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = ''
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'sgawebsite',
'sgawebsite.apps',
'sgawebsite.apps.main'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'sgawebsite.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'sgawebsite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
LOGIN_REDIRECT_URL = '/'

View File

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 795 B

After

Width:  |  Height:  |  Size: 795 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 944 B

After

Width:  |  Height:  |  Size: 944 B

View File

Before

Width:  |  Height:  |  Size: 91 B

After

Width:  |  Height:  |  Size: 91 B

View File

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 209 B

View File

Before

Width:  |  Height:  |  Size: 849 B

After

Width:  |  Height:  |  Size: 849 B

View File

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 4.1 MiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 28 MiB

After

Width:  |  Height:  |  Size: 28 MiB

View File

Before

Width:  |  Height:  |  Size: 267 KiB

After

Width:  |  Height:  |  Size: 267 KiB

View File

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 150 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
{% load static %}
<head>
<link href="{% static 'css/about.css' %}" rel="stylesheet" />
{% include 'head.html' %}
<title>About - TJSGA</title>
</head>
<body>
{% include 'header.html' %}
<div id="wrapper" class="fluid">
<section id="contact">
<h2>Contact Us!</h2>
<div class="desc">
<span class="quote">
"The world is moved not only by the mighty shoves of the heroes, but also by the aggregate of the tiny pushes of each honest worker." - Helen Keller
</span>
</div>
<div class="desc">
Contact us at
<a href="mailto:sga.tjhsst@gmail.com">sga.tjhsst@gmail.com</a>. We would love to answer questions or hear
about how you think we can improve TJ!
</div>
</section>
<hr />
{% for org in categories %}
<section id="{{ org.0 }}">
<h2>{{ org.1 }}</h2>
{% with key=data|get_item:org.0 %}
{% for member in key %}
<div class="{{ org.0 }}-intro">
<div class="{{ org.0 }}-image">
<img src="{{ member|filename }}" />
</div>
<div class="{{ org.0 }}-text">
<span>{{ member.first_name }} {{ member.last_name }}</span>
{% if member.category != 'sponsors' and member.category != 'senators' %}
<span>{{ member.year }}</span>
{% endif %}
{% if member.category != "officers" %}
<span>{{ member.title }}</span>
{% endif %}
{% if member.category == "officers" and member.intro != '' %}
<p>{{ member.intro }}</p>
{% endif %}
</div>
</div>
{% endfor %}
{% endwith %}
</section>
{% endfor %}
</div>
{% include 'footer.html' %}
</body>
</html>

View File

@ -0,0 +1,20 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<link href="{% static 'css/events.css' %}" rel="stylesheet" />
{% include 'head.html' %}
<title>Events - TJSGA</title>
</head>
<body>
{% include 'header.html' %}
<div id="wrapper" class="fluid">
<section id="calendar">
<iframe src="https://calendar.google.com/calendar/b/3/embed?showTitle=0&amp;showPrint=0&amp;height=600&amp;wkst=1&amp;bgcolor=%23ffffff&amp;src=sga.tjhsst%40gmail.com&amp;color=%23711616&amp;ctz=America%2FNew_York" style="border-width:0" width="800" height="600" frameborder="0" scrolling="no"></iframe>
</section>
<section id="events">
</section>
</div>
{% include 'footer.html' %}
</body>
</html>

View File

@ -1,3 +1,4 @@
{% load static %}
<footer> <footer>
<a href="https://facebook.com/tjsga" target="_blank"> <a href="https://facebook.com/tjsga" target="_blank">
<button class="social" id="fb"> <button class="social" id="fb">
@ -16,4 +17,4 @@
</button> </button>
</a> </a>
</footer> </footer>
<script src="js/sidebar-min.js"></script> <script src="{% static 'js/sidebar-min.js' %}"></script>

View File

@ -1,8 +1,3 @@
---
layout: compress
permalink: /forms
sections: ["general", "events", "elections"]
---
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>

View File

@ -1,3 +1,4 @@
{% load static %}
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="" name="description"> <meta content="" name="description">
<meta content="William Zhang" name="author"> <meta content="William Zhang" name="author">
@ -5,7 +6,7 @@
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0" /> <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0" />
<link href="icons/favicon.ico" rel="icon" type="image/ico"> <link href="icons/favicon.ico" rel="icon" type="image/ico">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet"/> <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet"/>
<link href="css/header.css" rel="stylesheet"/> <link href="{% static 'css/header.css' %}" rel="stylesheet"/>
<link href="css/main.css" rel="stylesheet"/> <link href="{% static 'css/main.css' %}" rel="stylesheet"/>
<link href="css/footer.css" rel="stylesheet"/> <link href="{% static 'css/footer.css' %}" rel="stylesheet"/>
<link href="css/responsive.css" rel="stylesheet"/> <link href="{% static 'css/responsive.css' %}" rel="stylesheet"/>

View File

@ -1,3 +1,4 @@
{% load static %}
<header> <header>
<div id="banner"> <div id="banner">
<button id="menu-toggle"> <button id="menu-toggle">
@ -18,8 +19,8 @@
<a class="menu-item" href="resources"> <a class="menu-item" href="resources">
<button class="menu-item fluid">Resources</button> <button class="menu-item fluid">Resources</button>
</a> </a>
<a class="menu-item" href="forms"> <a class="menu-item" href="events">
<button class="menu-item fluid">Forms</button> <button class="menu-item fluid">Events</button>
</a> </a>
</nav> </nav>
<div id="dome"> <div id="dome">

View File

@ -1,15 +1,12 @@
---
layout: compress
permalink: /
---
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
{% load static %}
<head> <head>
{% include head.html %} {% include 'head.html' %}
<title>Home - TJSGA</title> <title>Home - TJSGA</title>
</head> </head>
<body> <body>
{% include header.html %} {% include 'header.html' %}
<div id="wrapper" class="fluid"> <div id="wrapper" class="fluid">
<section id="intro"> <section id="intro">
<div id="intro-text" class="fluid"> <div id="intro-text" class="fluid">
@ -27,7 +24,7 @@ permalink: /
</div> </div>
</div> </div>
<div id="intro-image" class="fluid"> <div id="intro-image" class="fluid">
<img src="img/group.jpg" alt="TJSGA Group Photo" /> <img src="{% static 'img/group.jpg' %}" alt="TJSGA Group Photo" />
</div> </div>
</section> </section>
<hr /> <hr />
@ -46,10 +43,7 @@ permalink: /
</div> </div>
</section> </section>
<hr /> <hr />
<section id="calendar">
<iframe src="https://calendar.google.com/calendar/b/3/embed?showTitle=0&amp;showPrint=0&amp;height=600&amp;wkst=1&amp;bgcolor=%23ffffff&amp;src=sga.tjhsst%40gmail.com&amp;color=%23711616&amp;ctz=America%2FNew_York" style="border-width:0" width="800" height="600" frameborder="0" scrolling="no"></iframe>
</section>
</div> </div>
{% include footer.html %} {% include 'footer.html' %}
</body> </body>
</html> </html>

View File

@ -1,15 +1,12 @@
---
layout: compress
permalink: /resources
---
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
{% load static %}
<head> <head>
{% include head.html %} {% include 'head.html' %}
<title>Resources - TJSGA</title> <title>Resources - TJSGA</title>
</head> </head>
<body> <body>
{% include header.html %} {% include 'header.html' %}
<div id="wrapper" class="fluid"> <div id="wrapper" class="fluid">
<section id="resources"> <section id="resources">
<div class="list"> <div class="list">
@ -88,6 +85,6 @@ permalink: /resources
</div> </div>
</section> </section>
</div> </div>
{% include footer.html %} {% include 'footer.html' %}
</body> </body>
</html> </html>

34
sgawebsite/urls.py Normal file
View File

@ -0,0 +1,34 @@
"""sgawebsite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import include, url
from django.views.generic import TemplateView
from django.contrib import admin
from .apps.main import urls as main
import requests
about = requests.get('https://sgawebsite-e30e2.firebaseio.com/about.json')
forms = requests.get('https://sgawebsite-e30e2.firebaseio.com/forms.json')
with open('about.json', 'w') as f:
f.write(str(about.json()[0]))
with open('forms.json', 'w') as f:
f.write(str(forms.json()[0]))
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include(main)),
url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt'), name='robots.txt')
]

16
sgawebsite/wsgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
WSGI config for sgawebsite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sgawebsite.settings")
application = get_wsgi_application()