This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from greenlet import greenlet | |
| from time import sleep | |
| def ping(): | |
| while True: | |
| print "ping" | |
| sleep(0.5) | |
| pong_greenlet.switch() | |
| def pong(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| syntax on | |
| set encoding=utf-8 | |
| set fileformat=unix | |
| set number | |
| set expandtab | |
| set ignorecase | |
| set nowrap | |
| set shiftround " when at 3 spaces, and I hit > ... go to 4, not 5 | |
| set smartcase " if there are caps, go case-sensitive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| import os | |
| PROJECT_ROOT = os.path.dirname(__file__) | |
| settings = 'settings_%s.py' % socket.gethostname() | |
| try: | |
| execfile( os.path.join(PROJECT_ROOT, settings), globals(), locals()) | |
| except IOError: | |
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| PROJECT_ROOT = os.path.dirname(__file__) | |
| try: | |
| execfile(os.path.join(PROJECT_ROOT, 'local_settings.py'), globals(), locals()) | |
| except IOError: | |
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DEBUG = True | |
| INTERNAL_IPS = ('127.0.0.1',) | |
| MIDDLWARE_CLASSES = MIDDLWARE_CLASSES + ('debug_toolbar.middleware.DebugToolbarMiddleware',) | |
| INSTALLED_APPS = INSTALLED_APPS + ('debug_toolbar',) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try: | |
| from local_settings import * | |
| expect ImportError: | |
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from settings import * | |
| DEBUG = True | |
| DATABASES = { | |
| 'default': { | |
| 'ENGINE': 'django.db.backends.sqlite3', | |
| 'NAME': 'db.sqlite', | |
| 'USER': '', | |
| 'PASSWORD': '', | |
| 'HOST': '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.views.generic.simple import direct_to_template | |
| def myview(request): | |
| ... | |
| return direct_to_template(request, 'template.html', | |
| {'foo': ['one', 'two']}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.shortcuts import render_to_response | |
| from django.template import RequestContext | |
| def myview(request): | |
| ... | |
| return render_to_response('template.html', | |
| {'foo': ['one', 'two']}, | |
| context_instance=RequestContext(request)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.shortcuts import render_to_response | |
| def myview(request): | |
| ... | |
| return render_to_response('template.html', {'foo': ['one', 'two']}) |