Django-Snapbookwww.github.com/katychuang/django-snapbookNYC Pyladies Talk, 5/2/2013Twitter: @katychuang
ConceptA picture dictionary = Pictures + definitions
WireframeSearch
WireframeLink to home pageword (part of speech): definition goes hereList of relevant web pages•  something•  something•  ...
APIsPearson Dictionaryhttp://developer.pearson.com/apisTumblrwww.tumblr.com/apiNY Timeshttp://developer.nytimes.com/docs
The codeDjango Framework FilesEdited: views.pysettings.pyurls.py
Project/settings.pyChange the database settingsDATABASES = {default: {ENGINE: django.db.backends.sqlite3,# Add postgresql_...
Project/urls.pyurlpatterns = patterns(,url(r^$, example.views.home),# home page# http://localhost:8000/url(r^search/$, exa...
App/views.pydef home(request):return render_to_response("example/index.html",{page_title: django-snapbook,name: home})def ...
Search Box{% block main %}{% if name %}<form method="get" action="/search/"><label>Label for box</label><input type="text"...
Search Results{% block main %}{% if definition == "DNE" %}<h2><a href="/">&lt; Home</a></h2>no definitions found for {{ qu...
Images{% if tumble %}<ul class="photos">{% for p in tumble %}<li><img src="{{ p }}" height="200"></li>{% endfor %}</ul>{% ...
News Articles{% if nyt %}<h1>Articles about {{ query_string }} from NYT</h1><ul class="articles">{% for p in nyt %}<li><a ...
One page template* Display search box and button on homepage.* Display link to home page on results page.* If there is a d...
Heroku•  Free web hosting (python, ruby, php, etc)•  Demo here:http://blooming-forest-4284.herokuapp.comuses git command l...
The End
Upcoming SlideShare
Loading in …5
×

NYC Pyladies talk May 2, 2013

483 views
403 views

Published on

Django App connected to APIs for a picture dictionary.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
483
On SlideShare
0
From Embeds
0
Number of Embeds
148
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

NYC Pyladies talk May 2, 2013

  1. 1. Django-Snapbookwww.github.com/katychuang/django-snapbookNYC Pyladies Talk, 5/2/2013Twitter: @katychuang
  2. 2. ConceptA picture dictionary = Pictures + definitions
  3. 3. WireframeSearch
  4. 4. WireframeLink to home pageword (part of speech): definition goes hereList of relevant web pages•  something•  something•  somethingPICTURES OF WORD
  5. 5. APIsPearson Dictionaryhttp://developer.pearson.com/apisTumblrwww.tumblr.com/apiNY Timeshttp://developer.nytimes.com/docs
  6. 6. The codeDjango Framework FilesEdited: views.pysettings.pyurls.py
  7. 7. Project/settings.pyChange the database settingsDATABASES = {default: {ENGINE: django.db.backends.sqlite3,# Add postgresql_psycopg2, mysql, sqlite3 or oracle.NAME: ../sqlite.db,# Or path to database file if using sqlite3.}}
  8. 8. Project/urls.pyurlpatterns = patterns(,url(r^$, example.views.home),# home page# http://localhost:8000/url(r^search/$, example.views.search),# search results# http://localhost:8000/search/?q=cat)
  9. 9. App/views.pydef home(request):return render_to_response("example/index.html",{page_title: django-snapbook,name: home})def search(request):...
  10. 10. Search Box{% block main %}{% if name %}<form method="get" action="/search/"><label>Label for box</label><input type="text" placeholder="Type something..."name="q" id="id_q" size="35" /><input type="submit" value="Search"></form>{% endif %}{% endblock main %}
  11. 11. Search Results{% block main %}{% if definition == "DNE" %}<h2><a href="/">&lt; Home</a></h2>no definitions found for {{ query_string }}.{% elif definition %}<h2><a href="/">&lt; Home</a></h2><h1>{{ query_string }} ({{ pos }}) : {{ definition }}</h1>{% else %} &nbsp; {% endif %}{% endblock main %}
  12. 12. Images{% if tumble %}<ul class="photos">{% for p in tumble %}<li><img src="{{ p }}" height="200"></li>{% endfor %}</ul>{% endif %}
  13. 13. News Articles{% if nyt %}<h1>Articles about {{ query_string }} from NYT</h1><ul class="articles">{% for p in nyt %}<li><a href="{{ p.url }}"><b>{{ p.title }} </b></a>by {{ p.author }}<br /><small> {{ p.body }}</small></li>{% endfor %}</ul>{% endif %}
  14. 14. One page template* Display search box and button on homepage.* Display link to home page on results page.* If there is a definition, show it. Otherwise, letuser know message doesnt exist.* If there are photos of word, display them.Otherwise this section is blank.* If there are news articles, list them. Otherwisekeep this section blank.
  15. 15. Heroku•  Free web hosting (python, ruby, php, etc)•  Demo here:http://blooming-forest-4284.herokuapp.comuses git command line style to deploy$ git push heroku master
  16. 16. The End

×