From 38358d14db42ccd4dc11b5fc1117953b00c5306f Mon Sep 17 00:00:00 2001 From: William Zhang Date: Tue, 8 May 2018 16:34:00 -0400 Subject: [PATCH] make index work --- sgawebsite/manage.py => manage.py | 0 sgawebsite/__init__.py | 0 sgawebsite/apps/__init__.py | 0 sgawebsite/apps/main/urls.py | 9 ++ sgawebsite/apps/main/views.py | 15 +-- .../{sgawebsite => }/example_settings.py | 3 + .../__pycache__/__init__.cpython-36.pyc | Bin 136 -> 0 bytes .../__pycache__/settings.cpython-36.pyc | Bin 2253 -> 0 bytes sgawebsite/sgawebsite/settings.py | 124 ------------------ sgawebsite/templates/head.html | 9 +- sgawebsite/templates/header.html | 1 + sgawebsite/templates/index.html | 9 +- sgawebsite/{sgawebsite => }/urls.py | 4 +- sgawebsite/{sgawebsite => }/wsgi.py | 0 14 files changed, 30 insertions(+), 144 deletions(-) rename sgawebsite/manage.py => manage.py (100%) create mode 100644 sgawebsite/__init__.py create mode 100644 sgawebsite/apps/__init__.py create mode 100644 sgawebsite/apps/main/urls.py rename sgawebsite/{sgawebsite => }/example_settings.py (97%) delete mode 100644 sgawebsite/sgawebsite/__pycache__/__init__.cpython-36.pyc delete mode 100644 sgawebsite/sgawebsite/__pycache__/settings.cpython-36.pyc delete mode 100644 sgawebsite/sgawebsite/settings.py rename sgawebsite/{sgawebsite => }/urls.py (87%) rename sgawebsite/{sgawebsite => }/wsgi.py (100%) diff --git a/sgawebsite/manage.py b/manage.py similarity index 100% rename from sgawebsite/manage.py rename to manage.py diff --git a/sgawebsite/__init__.py b/sgawebsite/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sgawebsite/apps/__init__.py b/sgawebsite/apps/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sgawebsite/apps/main/urls.py b/sgawebsite/apps/main/urls.py new file mode 100644 index 0000000..1d7e9c2 --- /dev/null +++ b/sgawebsite/apps/main/urls.py @@ -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'), + +] diff --git a/sgawebsite/apps/main/views.py b/sgawebsite/apps/main/views.py index acf40c6..1b46a74 100644 --- a/sgawebsite/apps/main/views.py +++ b/sgawebsite/apps/main/views.py @@ -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") diff --git a/sgawebsite/sgawebsite/example_settings.py b/sgawebsite/example_settings.py similarity index 97% rename from sgawebsite/sgawebsite/example_settings.py rename to sgawebsite/example_settings.py index 4cf951a..d35834e 100644 --- a/sgawebsite/sgawebsite/example_settings.py +++ b/sgawebsite/example_settings.py @@ -37,6 +37,9 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'sgawebsite', + 'sgawebsite.apps', + 'sgawebsite.apps.main' ] MIDDLEWARE = [ diff --git a/sgawebsite/sgawebsite/__pycache__/__init__.cpython-36.pyc b/sgawebsite/sgawebsite/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 08cf76b3c9c78a6edbbe9be74d987d4a22203570..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 136 zcmXr!<>l%WdKJY01dl-k3@`#24nSPY0whuxf*CX!{Z=v*frJsnFH`-p#3KFj@^by+ q^u+Siq~gqyR2M!Ukb zUU}+&;1Be#^e5=GPwh|WQ%AC$_&D^CdadzjF5k?~&aC&=*NeYx{;l6xOQrryEqn^d zKf{Opfdo=|3eu3V(|VeuhnZn^feK{heL7xx4zhY41ifIT^i^1a9OR(@t5CFZdJ)dS z8mz+xoQDf=(aP)RU{ha%OI8X5*n-P&1+Kz1OQ31^?1NyX^>w(eZ@>+>nZ!Cza`5^4 z41Dn+L(}>NxCJ6w-hwX^`c*=2)3hb%7vYY+33v5Nn8_ACm+`p*U+Y&Pqo#K5nfKGF zRIxfVUCR?0;hee_6Z@VoGRqv3E~A`?Bi|d69+!&61L6|j(UgT4~WXMQX#;~5J6%Hy)3q7tc zdvH8~UR-w;?#^@$1+dB3^ohhsFYqa!Na~Df9P7dd%TTl6(t^J_l`VMfoDPBq>UgeH zNq#QLK^XXEwM!t=wYXGLmImpXw{C$7Z@C;mU3)qgrFhqD|{0G^!{pcy#C zr@hk%E5zLmn4axum9S943ms>sv~w-W8wOs*h7n~v76~Jh53u^wcd^Z*yxC=mq+l5F zO=1{&;km3T@li%aRjITU&3L8!60KB~=beLSU9Q(#M@rRr*-|w%+Nd>E4Mixx^H-x{ zqgJifl_R;WL~HFvg$#(2)-mqtdD>2wQ6?hTg)qD0DFGTKREv z%GJx?H=|rE({$X4hLI|9HovF*Ti7}Y`R8Hjo#~gx<8kSvSO1Hh{kuw|NmTgJ@gT6t z({qT#+DL> @@ -5,7 +6,7 @@ - - - - + + + + diff --git a/sgawebsite/templates/header.html b/sgawebsite/templates/header.html index 8aa427e..b829232 100644 --- a/sgawebsite/templates/header.html +++ b/sgawebsite/templates/header.html @@ -1,3 +1,4 @@ +{% load static %}
- {% include footer.html %} + {% include 'footer.html' %} diff --git a/sgawebsite/sgawebsite/urls.py b/sgawebsite/urls.py similarity index 87% rename from sgawebsite/sgawebsite/urls.py rename to sgawebsite/urls.py index d130071..38f3eb6 100644 --- a/sgawebsite/sgawebsite/urls.py +++ b/sgawebsite/urls.py @@ -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)) ] diff --git a/sgawebsite/sgawebsite/wsgi.py b/sgawebsite/wsgi.py similarity index 100% rename from sgawebsite/sgawebsite/wsgi.py rename to sgawebsite/wsgi.py