Skip to content

Instantly share code, notes, and snippets.

Original urls.py: notice `pykaboo_django`
---------------------------------------------------------------------------------------------------
from django.conf.urls.defaults import patterns, include, url
import pykaboo_django.core.views
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('', (r'^$', pykaboo_django.core.views.home), (r'^home$', pykaboo_django.core.views.home), (r'^install$', pykaboo_django.core.views.install), (r'Install', pykaboo_django.core.views.install), url(r'^admin/', include(admin.site.urls)),
)
@Bentley4
Bentley4 / shw.txt
Created August 15, 2012 17:05
Project is called 'pykaboo_django',
(env_pykaboo_django)~/django1.3_projects/pykaboo_django$ tree
.
├── core
│   ├── admin.py
│   ├── admin.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── static
@Bentley4
Bentley4 / her.txt
Created August 15, 2012 16:39
heroku tree
Tree I
app
└──├── core
├── __init__.py
├── manage.py
├── requirements.txt
├── settings.py
├── templates
└── urls.py
@Bentley4
Bentley4 / models.py
Created July 19, 2012 15:21
models.py in myproject/todo
from django.db import models
from django.contrib import admin
class DateTime(models.Model):
datetime = models.DateTimeField(auto_now_add = True)
def __unicode__(self):
return unicode(self.datetime)
class Item(models.Model):
name = models.CharField(max_length = 60)
@Bentley4
Bentley4 / gist:3032266
Created July 2, 2012 09:26
pyglet-walk.py runtime error
Traceback (most recent call last):
File "ircex.py", line 55, in <module>
pyglet.app.run()
File "/usr/local/lib/python2.7/dist-packages/pyglet/app/__init__.py", line 264, in run
EventLoop().run()
File "/usr/local/lib/python2.7/dist-packages/pyglet/app/xlib.py", line 93, in run
sleep_time = self.idle()
File "/usr/local/lib/python2.7/dist-packages/pyglet/app/__init__.py", line 193, in idle
window.dispatch_event('on_draw')
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/__init__.py", line 1219, in dispatch_event
@Bentley4
Bentley4 / pyglet-walk.py
Created July 2, 2012 09:23
Pyglet walking animation
import pyglet
def sprite_type(type_ = "standing"):
if type_ == "moving-forward":
moving_forward_image_list = [pyglet.image.load('assassin2.png'), pyglet.image.load('assassin3.png')]
moving_forward_animation = pyglet.image.Animation.from_image_sequence(moving_forward_image_list, 0.3)
return moving_forward_animation
if type_ == "standing":
standing_animation = pyglet.image.load("assassin1.png")
return standing_animation
@Bentley4
Bentley4 / flaskwp1.py
Created April 29, 2012 18:35
Files adjusted as Burhan Khalid suggested
from flask import Flask, render_template
app = Flask('flaskwp1')
#webcode = open('webcode.html').read()
@app.route('/')
def webprint():
return render_template('webcode.html')
if __name__ == '__main__':
@Bentley4
Bentley4 / flaskwp1.py
Created April 29, 2012 16:48
flaskwp1.py with H. Dunlop's suggestion
import flask
app = flask.Flask('flaskwp1')
webcode = open('webcode.html').read()
@app.route('/')
def webprint():
flask.url_for('static', filename='webcodestyle.css')
return webcode
@Bentley4
Bentley4 / flaskwp1.py
Created April 29, 2012 14:14
flaskwp1
import flask
app = flask.Flask('flaskwp1')
webcode = open('webcode.html').read()
@app.route('/')
def webprint():
return webcode
if __name__ == '__main__':