This file contains 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
// Being explicit with which settings file is used, allows two important properties. settings.py is ALWAYS in a production ready state, even if 'settingslocal' is accidentally checked into source control. The other nice side effect, is that every developers settings files are stored in source control - allowing each developer to share components of their settings files with their peers. | |
// runserver | |
python manage.py runserver --settings settingsjosh | |
// syncdb | |
python manage.py syncdb --settings settingsjosh |
This file contains 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
public static class TestHelpers | |
{ | |
public static void ShouldEqualWithDiff(this string actualValue, string expectedValue) | |
{ | |
if (actualValue == expectedValue) return; | |
Console.WriteLine("Idx Expected Actual"); | |
Console.WriteLine("---------------------"); | |
var maxLength = Math.Max(actualValue.Length, expectedValue.Length); | |
for (int i = 0; i < maxLength; i++) |
This file contains 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
# assuming python and pip are already installed | |
# installing the instantclient is usually where problems happen | |
# download the following files from oracle | |
# | |
# oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm | |
# oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm | |
# oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm | |
# install the rpms |
This file contains 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
# Note that the "smeatonj" below is the user that installed postgres with homebrew | |
# first, the "default" database: | |
$ createuser -U smeatonj djangotest -P | |
Enter password for new role: | |
Enter it again: | |
$ createdb djangotest | |
$ psql -U smeatonj -d djangotest |
This file contains 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
def _get_model(self): | |
DynamicClass = cache.get('DynamicModel_' + self.table_name) | |
if DynamicClass is None: | |
# get the custom columns required for this table.. | |
attrs = dict((c.column_name, models.CharField(max_length=100, blank=True, null=True)) for c in self.custom_fields.all()) | |
class Meta: | |
db_table = self.table_name | |
app_label = self._meta.app_label | |
managed = False |
This file contains 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 a command prompt: | |
# START http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/jarshwah/58f5f9f78d43ae269545/raw/e5a2076fbe76106b19ecaa62355776aa0a02fc91/boxstarter.ps1 | |
# Boxstarter options | |
$Boxstarter.RebootOk=$true # Allow reboots? | |
$Boxstarter.NoPassword=$false # Is this a machine with no login password? | |
$Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot | |
# Basic setup | |
Update-ExecutionPolicy Unrestricted |
This file has been truncated, but you can view the full file.
This file contains 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
vagrant@djangocore:~$ PYTHONPATH=/django /home/vagrant/.virtualenvs/py2.7/bin/python -m cProfile -s cumulative /django/tests/runtests.py --settings=djangocore_test_postgresql | |
Testing against Django installed in '/django/django' | |
Creating test database for alias 'default'... | |
Creating test database for alias 'other'... | |
..........................................................................................................................................................................................................................................................................................................................................................................x........................................................................................................................................................................................s.............................................................................................................................................................. |
This file contains 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
field=None value=1L | |
field=<django.db.models.fields.AutoField: id> value=u'159059725' | |
field=<django.db.models.fields.CharField: isbn> value=u'The Definitive Guide to Django: Web Development Done Right' | |
field=<django.db.models.fields.CharField: name> value=447L | |
field=<django.db.models.fields.IntegerField: pages> value=4.5 | |
field=<django.db.models.fields.FloatField: rating> value=Decimal('30.00') | |
field=<django.db.models.fields.DecimalField: price> value=1L | |
field=<django.db.models.fields.related.ForeignKey: contact> value=1L | |
field=<django.db.models.fields.related.ForeignKey: publisher> value=datetime.date(2007, 12, 6) | |
field=<django.db.models.fields.DateField: pubdate> value=1L |
This file contains 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
def g(letters=None): | |
if letters: return 'gal' | |
goal = ['go'] | |
def o(letters=None): | |
assert letters is None or letters == 'al' | |
if letters: | |
goal.append(letters) | |
return ''.join(goal) | |
goal.append('o') | |
return o |
This file contains 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
(django)[vagrant@peppermint django]$ ./runoracletests.py expressions | |
Testing against Django installed in '/django/django' | |
Creating test database for alias 'default'... | |
Creating test user... | |
Creating test database for alias 'other'... | |
Creating test user... | |
..s.................s.................. | |
---------------------------------------------------------------------- | |
Ran 39 tests in 386.525s |
OlderNewer