Lightning talks - Sunday AM
- Tim Cooper - Postgres-Python
- Gregg Lind - Print spring clean
- Natalia Bidart - Python Argentina
- David Huggins-Daines - You got Cython in my NumPy
- Ken Elkabany - Cloud Computing with Python
Overflow:
Lightning talks - Sunday AM
Overflow:
Lightning talks - Sunday PM
| #### settings.py | |
| TEMPLATE_DIRS = [ | |
| "/Users/jacob/Revsys/Training/yabl/templates", | |
| ] | |
| #### yabl/urls.py | |
| from django.conf.urls.defaults import * |
| # | |
| # Further reading: | |
| # Template builtins: http://docs.djangoproject.com/en/1.1/ref/templates/builtins/ | |
| # Generic view reference: http://docs.djangoproject.com/en/1.1/ref/generic-views/ | |
| # | |
| #### entries/urls.py | |
| from django.conf.urls.defaults import * |
| #### yabl/urls.py | |
| from django.conf.urls.defaults import * | |
| from django.contrib import admin | |
| admin.autodiscover() | |
| urlpatterns = patterns('', | |
| (r'^admin/', include(admin.site.urls)), | |
| (r'^authors/', include('yabl.authors.urls')), | |
| (r'^entries/', include('yabl.entries.urls')), |
| {% extends "base.html" %} | |
| {% block content %} | |
| <h1>Log in:</h1> | |
| <form action="" method="post"> | |
| {{ form.as_p }} | |
| <input type="hidden" name="next" value="/authors/"> | |
| <input type="submit"> | |
| </form> | |
| {% endblock content %} |
| def index(request): | |
| key = 'yabl_author_index' | |
| response = cache.get(key) | |
| if response is None or 'clear_cache' in request.GET: | |
| response = render_to_response( | |
| 'authors/index.html', | |
| {'authors': Author.objects.all()}, | |
| RequestContext(request), | |
| ) | |
| cache.set(key, response, 15) |
| def build_dsn(dbtype, params): | |
| """ | |
| Build a DSN-style connection string, a la: | |
| postgres://dbname=jacob,dbpass=sekreit | |
| Returns a string. | |
| """ | |
| args = ",".join(["%s=%s" % (k,v) for (k,v) in params.items()]) | |
| return "%s://%s" % (dbtype, args) |