From 0a6c2640f55c5fd575c327e587fdf16222e53053 Mon Sep 17 00:00:00 2001 From: Anna Cho Date: Thu, 29 Sep 2016 11:05:02 -0700 Subject: [PATCH 1/3] submitting hw4 --- Assignment/.DS_Store | Bin 0 -> 6148 bytes Assignment/HW4_Soundcloud/index.html | 32 ++++++ .../startercode_HW4_skeleton.js | 56 ++++++++- Assignment/HW4_Soundcloud/style.css | 108 ++++++++++++++++++ 4 files changed, 192 insertions(+), 4 deletions(-) create mode 100644 Assignment/.DS_Store create mode 100644 Assignment/HW4_Soundcloud/index.html create mode 100644 Assignment/HW4_Soundcloud/style.css diff --git a/Assignment/.DS_Store b/Assignment/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..6ca4d2bea6624e2ecd2f232d09f80f3dd8c8c611 GIT binary patch literal 6148 zcmeHKJxjz;5S-O34us=M%l8)qe?T}+xITrYf&rT&2f|sW@^|^uoc%xuIl;z8W?^^U z+w8nYrpRUi*zP>s0b2lTx+6Y3EX|+0FYKx^Mx^tM9w(eJV!+Fy`f|d#8yxV6dpynf z$2ebk-yG3l@xKCEuGnoulm=lLzl zVO^r46p#XQ1+H_u_5S}r|6%^0leCipQs7@HV5@z<-|>~Iw=Q1Jdu^jX)4k@C?#6Xc n7@{2$qaAbO?f5o|vab1>&%44YG3d+(ov5Dy*F`1;{#t=AGd>oy literal 0 HcmV?d00001 diff --git a/Assignment/HW4_Soundcloud/index.html b/Assignment/HW4_Soundcloud/index.html new file mode 100644 index 0000000..785d444 --- /dev/null +++ b/Assignment/HW4_Soundcloud/index.html @@ -0,0 +1,32 @@ + + + + + Anna's Soundcloud + + + + + +
+ Soundcloud Logo +
+ +
+

Search Results

+
+
+ +
+

Playlist

+
+
+ + + + + \ No newline at end of file diff --git a/Assignment/HW4_Soundcloud/startercode_HW4_skeleton.js b/Assignment/HW4_Soundcloud/startercode_HW4_skeleton.js index dbd277e..14929fa 100644 --- a/Assignment/HW4_Soundcloud/startercode_HW4_skeleton.js +++ b/Assignment/HW4_Soundcloud/startercode_HW4_skeleton.js @@ -1,11 +1,20 @@ -// Event hander for calling the SoundCloud API using the user's search query -function callAPI(query) { +//FFBB97, F69875, FF5701, FDD0C0, FE712F +function callAPI(query) { // Takes in the user's input as argument, 'query', and returns the first 20 search results. $.get("https://api.soundcloud.com/tracks?client_id=b3179c0738764e846066975c2571aebb", {'q': query, 'limit': '200'}, function(data) { - // PUT IN YOUR CODE HERE TO PROCESS THE SOUNDCLOUD API'S RESPONSE OBJECT - // HINT: CREATE A SEPARATE FUNCTION AND CALL IT HERE + for (i = 0; i < 20; i++) { // First 20 search results + var art = data[i]['artwork_url']; // artwork url + if (art == null) { // Default artwork + art = 'http://ichef.bbci.co.uk/news/624/cpsprodpb/7402/production/_91389692_ctrdewvumaalgc_.jpg' + } + var artwork = "Album Artwork"; + var title = data[i]['title']; + var playURL = data[i]['permalink_url']; + + $('#list_results').append("
" + artwork + "" + title + "
"); + } },'json' ); } @@ -24,4 +33,43 @@ function changeTrack(url) { }); } +$(document).ready( // When user clicks "Go!" button, a task is added a search is started + $("#search-button").on('click', function() { + // once the document loads, create new item with this function + $('#list_results').empty(); + var user_input = $('#search_box').val(); + if (user_input != "") { + callAPI(user_input); // calls the search. + } + }) +); +$("#list_results").on('click', "#addButton", function() { // When user clicks "Add to Playlist" button, task is added to Playlist. + var copy = $(this).parent().clone(); + $(copy).children('#addButton').html('Remove'); // Adds 'Remove' button to each song added to the playlist. + $(copy).append(""); // Adds up and down buttons. + $("#list_playlist").prepend(copy); +}); + +$("#list_results").on('click', "#playButton", function() { // When user clicks "Play" button, song will play (from search results). + var songURL = $(this).attr('data-url'); + changeTrack(songURL); +}); + +$("#list_playlist").on('click', "#playButton", function() { // When user clicks "Play" button, song will play (from playlist). + var songURL = $(this).attr('data-url'); + changeTrack(songURL); +}); + + +$("#list_playlist").on('click', "#addButton", function() { // When user clicks "Remove" button, removes from playlist. + $(this).parent().remove(); +}); + +$("#list_playlist").on('click', ".up", function() { // When user clicks "up" button, song is moved up in playlist. + $(this).parent().insertBefore($(this).parent().prev()); +}); + +$("#list_playlist").on('click', ".down", function() { // When user clicks "down" button, song is moved down in playlist. + $(this).parent().insertAfter($(this).parent().next()); +}); \ No newline at end of file diff --git a/Assignment/HW4_Soundcloud/style.css b/Assignment/HW4_Soundcloud/style.css new file mode 100644 index 0000000..b3f24db --- /dev/null +++ b/Assignment/HW4_Soundcloud/style.css @@ -0,0 +1,108 @@ +/* Add CSS */ +body { + background-color: #FF3500; +} + +img { + width: 25%; + height: auto; + display: block; + margin: auto; +} + +h2 { + font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; + text-align: center; + color: white; + display: inline-block; + width: 100%; +} + +input[type='text'] { + font-size: 24px; +} + +li { + font-size: medium; + font-family: 'Roboto', sans-serif; + width: 75%; + margin-left: 16%; + margin-right: 16%; +} + +/*.each-result button { + float: right; + margin-top: 20px; +}*/ + +#playButton { + float: right; + width: 7%; +} + +#addButton { + float: right; + width: 12%; +} + +.up, .down { + float: right; +} + +.search { + text-align: center; +} + +.search input { + width: 85%; +} + +#search-button { + width: 10%; + font-size: 20px; +} + +.album-art { + display: inline-block; + width: 20%; +} + +.album-art img { + width: 50%; +} + +.song { + display: inline-block; + width: 40%; + color: white; + padding-bottom: 20px; +} + +.each-result { + border: 1px solid #FDD0C0; + width: 100%; +} + +#all_songs_container { + margin-top: 20px; + border: 1px solid white; + width: 48%; + float: left; + background-color: black; +} + +#playlist_container { + margin-top: 20px; + border: 1px solid white; + width: 48%; + float: right; + background-color: black; +} + +#list_results { + width: 100%; +} + +#list_playlist { + width: 100%; +} \ No newline at end of file From eff857bec3cc10e7befaff236cc721c304bdd583 Mon Sep 17 00:00:00 2001 From: Anna Cho Date: Thu, 6 Oct 2016 10:17:44 -0700 Subject: [PATCH 2/3] submitting flaskLab2 --- .DS_Store | Bin 0 -> 6148 bytes Labs/.DS_Store | Bin 0 -> 6148 bytes Labs/flaskLab2.zip | Bin 0 -> 8072 bytes Labs/flaskLab2/.spyderworkspace | Bin 0 -> 50 bytes Labs/flaskLab2/app/__init__.py | 4 + Labs/flaskLab2/app/__init__.pyc | Bin 0 -> 278 bytes .../app/__pycache__/__init__.cpython-35.pyc | Bin 0 -> 251 bytes .../app/__pycache__/views.cpython-35.pyc | Bin 0 -> 1900 bytes Labs/flaskLab2/app/static/interactions.js | 39 +++ Labs/flaskLab2/app/static/main.css | 225 ++++++++++++++++++ Labs/flaskLab2/app/templates/base.html | 33 +++ Labs/flaskLab2/app/templates/login.html | 17 ++ .../app/templates/not_authorized.html | 13 + .../app/templates/page_not_found.html | 12 + Labs/flaskLab2/app/templates/results.html | 32 +++ Labs/flaskLab2/app/templates/survey.html | 32 +++ Labs/flaskLab2/app/views.py | 49 ++++ Labs/flaskLab2/app/views.pyc | Bin 0 -> 2299 bytes Labs/flaskLab2/run.py | 3 + 19 files changed, 459 insertions(+) create mode 100644 .DS_Store create mode 100644 Labs/.DS_Store create mode 100644 Labs/flaskLab2.zip create mode 100755 Labs/flaskLab2/.spyderworkspace create mode 100755 Labs/flaskLab2/app/__init__.py create mode 100755 Labs/flaskLab2/app/__init__.pyc create mode 100644 Labs/flaskLab2/app/__pycache__/__init__.cpython-35.pyc create mode 100644 Labs/flaskLab2/app/__pycache__/views.cpython-35.pyc create mode 100755 Labs/flaskLab2/app/static/interactions.js create mode 100755 Labs/flaskLab2/app/static/main.css create mode 100755 Labs/flaskLab2/app/templates/base.html create mode 100755 Labs/flaskLab2/app/templates/login.html create mode 100755 Labs/flaskLab2/app/templates/not_authorized.html create mode 100755 Labs/flaskLab2/app/templates/page_not_found.html create mode 100755 Labs/flaskLab2/app/templates/results.html create mode 100755 Labs/flaskLab2/app/templates/survey.html create mode 100755 Labs/flaskLab2/app/views.py create mode 100755 Labs/flaskLab2/app/views.pyc create mode 100755 Labs/flaskLab2/run.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3f0a6caf194a92ea81cc62ffb6d87521b67a4f9d GIT binary patch literal 6148 zcmeH~u?oUK42Bc!P;lw!c#99<8yrP9H(x+Sa1jMX=X-SjUK-q5{*H9yD6j z#}KP~J2b_)99pW@cF`C;cV!i0`QgOGwy`I%KQMGk}L;X0y%TE9jyNai9H|!@{KyzrRiVBQB0*--!1inh( E0ZnZZl>h($ literal 0 HcmV?d00001 diff --git a/Labs/.DS_Store b/Labs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8287b5d6db77a77d9fe71e2c372bae54d93d732b GIT binary patch literal 6148 zcmeHKF-`+P474FdPzq8~?ib(%t0)vmbbJ5~M8iobQ2MKQ7e5O#wuOie8YCJtmh9Q} zdTw)5oMSWd&Hm}qY;9&sIMLo1=EigS%uXufKscW9Vz>5SgI(Q>v+C~?m8d8Mq<|FoRDj=y1}FByDKS1B z2r&Wx7f6R;9kT?mF#+s_Qz9}jPbx5}UL%Gl9r;#uy>LoQx_R7;=hV$!6N<;}$hRmr z?}>_1KnffyaGKjS`~Nlkhxz}Qq@5Iy0{=<@Uu^HT8@y8W*4fLk*EaY)oHg%o8rDHU mh;|H&c8m?%@kJD6UE><(y>LnlI`TmW>dydmkx7BSR^S8Hry7_5 literal 0 HcmV?d00001 diff --git a/Labs/flaskLab2.zip b/Labs/flaskLab2.zip new file mode 100644 index 0000000000000000000000000000000000000000..29f66dc0b914de346401c9622cffa65a43211f16 GIT binary patch literal 8072 zcmai(1yq#V_xFeHkP-x>q+43L5u`&Jh8~)k0fa%yA(T*t1_4n(LP{D55h>}A1_9}o zk`n&I_4SAMUcB!!>sd2v&2v8IoPG9l_SyTZrG|!12DrF}d<|8UdJU^@BY$7qH;}iT zGZ5l*4`_9pmj~kRV`B^Ub^|*>+=14%fv68XP}uYd+`(>+w$@M!cOcXO;(=~!Q<|u#`&pNU#0UdSC2t^7k4`^hqgPKM|CxrlN1k^%$dP7>hQ4c zhxFaq1}}7qttQ%YI*1y6zLZ>rsZE^=14(UhE}H2@9Weq-#$eoW-s`A^l|q06^m( zD@6V;t3#kbD9HM^g&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)A_KGBKjrd=iaHMhJktU#5Lq+4|(eLzYy91{|DKfQ7!-g literal 0 HcmV?d00001 diff --git a/Labs/flaskLab2/.spyderworkspace b/Labs/flaskLab2/.spyderworkspace new file mode 100755 index 0000000000000000000000000000000000000000..be24de3f58bb019a1446608c26e01e2dc4121a3e GIT binary patch literal 50 zcmZo*sx4&H2<0s(%FjwoE{QKlEXgP?WQq-C$xF;lEo6@1WME+MNla2m%SkNGE@Uay F0|1r^4`~1Z literal 0 HcmV?d00001 diff --git a/Labs/flaskLab2/app/__init__.py b/Labs/flaskLab2/app/__init__.py new file mode 100755 index 0000000..9a4e940 --- /dev/null +++ b/Labs/flaskLab2/app/__init__.py @@ -0,0 +1,4 @@ +from flask import Flask + +myapp = Flask(__name__) +from app import views diff --git a/Labs/flaskLab2/app/__init__.pyc b/Labs/flaskLab2/app/__init__.pyc new file mode 100755 index 0000000000000000000000000000000000000000..4d4e5adeb859807192e959f25c2546b087e0a2ed GIT binary patch literal 278 zcmYjLOA5j;5S_GEL=-%N%dR9_Kd7L%5*LatBrv2lLNTeOiNCe?^D-Vlr$x~r^JZQi z^Je^Kvp(uSHaqx)M|DhTIYCU1fd()PwhWkJpggz}@k`AET>%roHUJj;unH?Ql)NZH zMx6@?W?I_AkDe2Cv5TlUe3``lh-p97D=Kuw9~)o>*Iz zTM^}H&XIF2rpg}NF%wd&tC-8EU2YNNA`p`_afqGlRxTWvV|>zTSh(Bb{Fc{XZ~f0Y AU;qFB literal 0 HcmV?d00001 diff --git a/Labs/flaskLab2/app/__pycache__/__init__.cpython-35.pyc b/Labs/flaskLab2/app/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e42aa9725e1138f2d8b85f4f84ecb2c528d0e742 GIT binary patch literal 251 zcmX|)v2MaJ5QhIt;uay0I`Iw}sDT+!hpMO&Dg&ZJ7Aqx2im*czL#xa@4KKq3cxCD< zF!hq5C*SA)?w5ZL`u*-`c>P=exN-ki!0LtDjTjjpf&nZcA&@5M0B0V;)(c=FSb;=< zvJmSy`sG)M$%{9Wx_u+QbN%B!;)g`+npM?&;5$kcsntq(Ve7OkeaNUnwl1h1`D$^W z$&J&MliKE{mam8H$?D?h0}$rY9cv9DwP-cQK{#$_MNFcWGAEN#EC9q IJOw@a1BW0xh5!Hn literal 0 HcmV?d00001 diff --git a/Labs/flaskLab2/app/__pycache__/views.cpython-35.pyc b/Labs/flaskLab2/app/__pycache__/views.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9f7acf401b82fcd5f1832f8c4d488a3a2d4fbfe1 GIT binary patch literal 1900 zcmaJ>&2Ah;5U!rz-Sz(24o-lO9HTwh135+!3Iv1@XpPt)q`6q*?OuEBnVn7dtidZs zLNbrQOYkN<0f)WG=G^V0KX`|NmDQ{BRB-Ny| z7Ri9F1t~#CTTIW|B*T@2`G|QLlWfq>#5{g!XRX;J2@6{!+jQdLNXQP!?n*Q5uGMuF3DSKwZ2o^Ci#xDut)Ot`Un?&8V&BeWS|DZhQ(zzpARA%YxR7g zOl5mo&7{&tl`7_WRw)}BWz4jk*@jkfs@1r%@j~ZElTzDAnQ=B(!AC=1O!=l;jpiW&Lh$fsS*Sp*?1Qq;jHr5M;Xu+BPT|@ci4`Qw9z0M zTC$CWQF@jYYPn?=`a)eEoK{6{11DAC+NH{laT&U`_l*amBeE!S^-yDvf-Js*HfjD#y!2pOe6po;CkMvh=>(Lp| z;4+~qVCFF^)lz>g^&t(ZidJ-2I=vw&_%Wl)-bT-^~4@t%|)<`Iqq^%{dbTbLggk%uU9mWG>B zH$qq%ZAxR#I7=Iw(&k#)f;3!>7PJpAyn@FazHu%55ubHgx2}%fP;Vi+*WlW4T;`=t zQ4Xa{8yDF)tI+vrW1>D)C=s=6PSpOfW7Bw|KABWXFLAn`Ij*ghS>%;*y{9{{ZM!wL z-zqaNXGSeIn={&IPR3mCF}cme^{W5cGkuq(+_N=tb=a=cH*yo;9?lG>mApu-S`l9^ z%=*3S=?`!^{RJ~=%yWq!{(4w0)!etpEwT-Wkmreq;`4{g-FbGRj%H + + + + + {% block title %}{% endblock %} - Ape Ask + + + + {% block styles %}{% endblock %} + + + + +
+ {% block header %} +
+
+ +
+

Ape Ask

+
+ {% endblock %} +
+
{% block content %}{% endblock %}
+ +
+

© Copyright 2016 Ape Ask, all rights reserved

+
+ + + + \ No newline at end of file diff --git a/Labs/flaskLab2/app/templates/login.html b/Labs/flaskLab2/app/templates/login.html new file mode 100755 index 0000000..77e1830 --- /dev/null +++ b/Labs/flaskLab2/app/templates/login.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% block title %} + Login +{% endblock %} + +{% block content %} +

Hi There! Welcome to Ape Ask, the leading online survey site.

+
+

Let's get you logged in

+
+ + + +
+
+{% endblock %} + diff --git a/Labs/flaskLab2/app/templates/not_authorized.html b/Labs/flaskLab2/app/templates/not_authorized.html new file mode 100755 index 0000000..99a0c25 --- /dev/null +++ b/Labs/flaskLab2/app/templates/not_authorized.html @@ -0,0 +1,13 @@ + + + + + Oops! + + +

Uh Oh! You're not authorized

+ +
+ Take me back home, already! + + \ No newline at end of file diff --git a/Labs/flaskLab2/app/templates/page_not_found.html b/Labs/flaskLab2/app/templates/page_not_found.html new file mode 100755 index 0000000..dadcc99 --- /dev/null +++ b/Labs/flaskLab2/app/templates/page_not_found.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% block title %} + Oops! +{% endblock %} + +{% block content %} +

Oh, Pooh Bear! You're stuck because we don't have that page for you.

+ +
+ Go back! +{% endblock %} \ No newline at end of file diff --git a/Labs/flaskLab2/app/templates/results.html b/Labs/flaskLab2/app/templates/results.html new file mode 100755 index 0000000..b8818eb --- /dev/null +++ b/Labs/flaskLab2/app/templates/results.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} + +{% block title %} + Survey +{% endblock %} + +{% block header %} + {{ super() }} +
+ Logged in as {{ name }} + +
+{% endblock %} + +{% block content %} +

Great news - your results are in! Check it out...

+
+

Here are some of your favorite things

+ Your favorite color is {{ surveyResponse['color']}} + Your favorite food is {{ surveyResponse['food']}} + Your favorite vacation spot is {{ surveyResponse['vacation']}} + +

Wow! Your front end skillz are getting sharp!

+ Before IO Lab, your front end skillz were at a {{ surveyResponse['fe-before']}} + But in just a few short weeks of IO Lab, your front end skillz are now a {{ surveyResponse['fe-after']}} + +
+ Want your survey results emailed to you? + Yes! +
+
+{% endblock %} \ No newline at end of file diff --git a/Labs/flaskLab2/app/templates/survey.html b/Labs/flaskLab2/app/templates/survey.html new file mode 100755 index 0000000..10191e8 --- /dev/null +++ b/Labs/flaskLab2/app/templates/survey.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} + +{% block title %} + Survey +{% endblock %} + +{% block header %} +{{super()}} +
+ Logged in as {{ name }} + +
+{% endblock %} + + +{% block content %} +

A Little Survey About You

+
+

Some of your favorites

+ + + + +

Let's look at your front end skillz progression

+ + + + +
+{% endblock %} \ No newline at end of file diff --git a/Labs/flaskLab2/app/views.py b/Labs/flaskLab2/app/views.py new file mode 100755 index 0000000..f7f050f --- /dev/null +++ b/Labs/flaskLab2/app/views.py @@ -0,0 +1,49 @@ +from app import myapp +from flask import request, render_template, session, redirect, url_for, escape +import os + +myapp.secret_key = os.urandom(24) + +@myapp.route('/') +@myapp.route('/index') +def index(): + username = '' + if 'username' in session: + username = escape(session['username']) + return render_template('survey.html', name=username) + else: + return render_template('login.html') + +@myapp.route('/login', methods=['GET', 'POST']) +def login(): + if request.method=='POST': + session['username'] = request.form.get("username") + session['email'] = request.form.get("email") + return redirect(url_for('index')) + +@myapp.route('/logout') +def logout(): + session.pop('username', None) + session.pop('email', None) + return redirect(url_for('index')) + +@myapp.route('/submit-survey', methods=['GET', 'POST']) +def submitSurvey(): + username = '' + email = '' + if 'username' in session: + username = escape(session['username']) + email = escape(session['email']) + surveyResponse = {} + surveyResponse['color'] = request.form.get('color') + surveyResponse['food'] = request.form.get('food') + surveyResponse['vacation'] = request.form.get('vacation') + surveyResponse['fe-before'] = request.form.get('feBefore') + surveyResponse['fe-after'] = request.form.get('feAfter') + return render_template('results.html', name=username, email=email, surveyResponse=surveyResponse) + else: + return render_template('login.html') + +@myapp.errorhandler(404) +def page_not_found(error): + return render_template('page_not_found.html'), 404 \ No newline at end of file diff --git a/Labs/flaskLab2/app/views.pyc b/Labs/flaskLab2/app/views.pyc new file mode 100755 index 0000000000000000000000000000000000000000..259c8d15006dc6248a0b27530dcff389a33fa068 GIT binary patch literal 2299 zcmcIlOK&4Z5U%cV{79U{&I+`!Aoj2aUpBEo;(%6Ym$2f33>q&8jVxIcPdgcVUQD;c zM#`STPvA#!Z*QJef3p2_-l9jr@#OBaYpOU7QUZj*teJx z{42_caz&9M#cNHOraYi1pu9m*gYqqkwkU5>)TF#cQH%06MQy)3psYhthfIeS+mtlu zN|8}C-QjuBrDSWZVY$h2(xP991^h?5n{91MI+Wms9Xi!8sieE!7VT~J?8@=IjedWl z-@kLVx7pK^J$*|0a`s@OKcFO_@!$b4NZ;Z!P>>vBlV8MDHE8m(g{d|_uZ(qWU*sY& z_0*ZX%3^24ZjH5RS-7^?le9K7Cx%s>P3L9p_$Fg#ab-s7L&%O_IYnEt^z-$_F7MJs$u#*qr7Vk_KHenrh5z0eg%rjwON-4qzkuwz8%! z;@sFBEbOX2Hy4LzF3%jlDu!(cS$Uckq8|iUhBC3Mp~fU2g&meK{A53ebo|BS2i$Kb zCv{N|r^DfJ^0l!`S5}iaGp{G##wU;GS!|aRU^_Wa%`f(_x)8Vp0tVXh`xG=)SM^j+ zdw|3rfipMmtW2z9kG^^NO5FbbyYZ_TpW+W2jxp>@Oo)2{rYTx#s$a+w=m0vL$JaBq z3w)voplERR0jB4rhmh$o3imKe(BiMj<1`ByL_s(d-Y`PmLGcS|&pmVuZphc%04CCX zQ4?JHxYu%SN$=~v>MP4Q9>G?w++AFTFka&Vid<<@>ouTQuLD8^pw$|N0S7RW=tHgm zA2u2Cy}@=(i+~ouMd)z}v>IT{wN{FbwOhBf((72;ysd39 zvaD_2)^;}9ZD>Km9YXg*StAjb@OYO`T&ZBpwmshK`Ng&gTkhJ>WEGDGL#T+GWd zk@`Q6XR+Hfs=4{ffTYH9Ezix<6In@}&CQFsLn-sEu*9=;YKd(3O*5b35` zHyYK{?<@St{E<$7gOf9Mlm|CGAyE$kSOXpbd@yLP(P7!|k>#I|Dn2#SqI78Zt0EDI zl)S>F?1Km}RI!`(en@=A61M&306#xJL literal 0 HcmV?d00001 diff --git a/Labs/flaskLab2/run.py b/Labs/flaskLab2/run.py new file mode 100755 index 0000000..dae9904 --- /dev/null +++ b/Labs/flaskLab2/run.py @@ -0,0 +1,3 @@ +#!flask/bin/python +from app import myapp +myapp.run(debug=True,host='0.0.0.0') From a8fbc3b2964347e355e4901871e1c738d7920695 Mon Sep 17 00:00:00 2001 From: Anna Cho Date: Thu, 6 Oct 2016 10:53:32 -0700 Subject: [PATCH 3/3] FINAL: submitting flaskLab2 --- Labs/flaskLab2/app/templates/survey.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Labs/flaskLab2/app/templates/survey.html b/Labs/flaskLab2/app/templates/survey.html index 10191e8..d6b7b6e 100755 --- a/Labs/flaskLab2/app/templates/survey.html +++ b/Labs/flaskLab2/app/templates/survey.html @@ -17,7 +17,7 @@

A Little Survey About You

Some of your favorites

- +