make index work

This commit is contained in:
William Zhang 2018-05-08 16:34:00 -04:00
parent a04caa12b8
commit 38358d14db
14 changed files with 30 additions and 144 deletions

0
sgawebsite/__init__.py Normal file
View File

View File

View File

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

View File

@ -1,14 +1,7 @@
from django.shortcuts import render
@app.route("/")
def index():
announcements = Announcement.query.all()
return render_template(
"index.html",
prefix=ROOT_URL,
announcements=announcements)
def index(request):
return render(request, "index.html")
# Create your views here.
def index():
return
def about(request):
return render(request, "about.html")

View File

@ -37,6 +37,9 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'sgawebsite',
'sgawebsite.apps',
'sgawebsite.apps.main'
]
MIDDLEWARE = [

View File

@ -1,124 +0,0 @@
"""
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 = '#6676vzm14drh2_a%yfywjd(k@p6btn(j#y9u1dyt9g-(8m-3-'
# 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',
]
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

@ -1,3 +1,4 @@
{% load static %}
<meta charset="UTF-8">
<meta content="" name="description">
<meta content="William Zhang" name="author">
@ -5,7 +6,7 @@
<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="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet"/>
<link href="css/header.css" rel="stylesheet"/>
<link href="css/main.css" rel="stylesheet"/>
<link href="css/footer.css" rel="stylesheet"/>
<link href="css/responsive.css" rel="stylesheet"/>
<link href="{% static 'css/header.css' %}" rel="stylesheet"/>
<link href="{% static 'css/main.css' %}" rel="stylesheet"/>
<link href="{% static 'css/footer.css' %}" rel="stylesheet"/>
<link href="{% static 'css/responsive.css' %}" rel="stylesheet"/>

View File

@ -1,3 +1,4 @@
{% load static %}
<header>
<div id="banner">
<button id="menu-toggle">

View File

@ -1,11 +1,12 @@
<!DOCTYPE html>
<html>
{% load static %}
<head>
{% include head.html %}
{% include 'head.html' %}
<title>Home - TJSGA</title>
</head>
<body>
{% include header.html %}
{% include 'header.html' %}
<div id="wrapper" class="fluid">
<section id="intro">
<div id="intro-text" class="fluid">
@ -34,7 +35,7 @@
</div>
</div>
<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>
</section>
<hr />
@ -57,6 +58,6 @@
<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>
{% include footer.html %}
{% include 'footer.html' %}
</body>
</html>

View File

@ -13,9 +13,11 @@ 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 url
from django.conf.urls import include, url
from django.contrib import admin
from .apps.main import urls as main
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include(main))
]