Skip to content

Commit

Permalink
migration to django 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
graik committed Feb 7, 2014
1 parent 213f747 commit fa5fb56
Show file tree
Hide file tree
Showing 725 changed files with 15,762 additions and 28 deletions.
10 changes: 0 additions & 10 deletions config/django.wsgi

This file was deleted.

9 changes: 9 additions & 0 deletions labhamster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,13 @@

## You should have received a copy of the GNU Affero General Public
## License along with labhamster. If not, see <http://www.gnu.org/licenses/>.
VERSION = (1,0,0)

__version__ = '.'.join([ str(i) for i in VERSION])

import os.path as osp
import sys

project_root = osp.abspath( osp.split( osp.abspath(__file__) )[0] + '/../' )

sys.path.append( osp.join( project_root, 'thirdparty'))
7 changes: 4 additions & 3 deletions labhamster/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class Item(models.Model):
status = models.CharField('Status', max_length=20, choices=STATUS_TYPES,
default='out')

link = models.URLField(verify_exists=False, blank=True,
link = models.URLField(blank=True,
help_text='URL Link to product description')

comment = models.TextField('comments & description', blank=True,
Expand Down Expand Up @@ -236,7 +236,7 @@ class Vendor(models.Model):
verbose_name='Vendor name',
help_text='short descriptive name of this supplier')

link = models.URLField(verify_exists=True, blank=True,
link = models.URLField(blank=True,
help_text='URL Link to Vendor home page')

phone = models.CharField(max_length=20, blank=True,
Expand Down Expand Up @@ -300,4 +300,5 @@ def __unicode__(self):
return unicode(self.name + u' ' + self.grant_id)

class Meta:
ordering = ('name', 'grant_id')
ordering = ('name', 'grant_id')
verbose_name = 'Grant'
17 changes: 14 additions & 3 deletions settings.py → labhamster/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')

ROOT_URLCONF = 'labhamsterproject.urls'
ROOT_URLCONF = 'urls'
TEMPLATE_DIRS = ()

INSTALLED_APPS = ('django.contrib.admin',
Expand All @@ -71,8 +71,19 @@

LOGGING = {'version': 1,
'disable_existing_loggers': False,
'handlers': {'mail_admins': {'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'}},

## slashdot hint: http://stackoverflow.com/questions/1598823/elegant-setup-of-python-logging-in-django
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},

'handlers': {'mail_admins':
{'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'}
},
'loggers': {'django.request': {'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True}}}
2 changes: 1 addition & 1 deletion urls.py → labhamster/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
## License along with labhamster. If not, see <http://www.gnu.org/licenses/>.


from django.conf.urls.defaults import patterns, include, url
from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()
Expand Down
Empty file added labhamstersite/__init__.py
Empty file.
99 changes: 99 additions & 0 deletions labhamstersite/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
## Copyright 2012 Raik Gruenberg

## This file is part of the labhamster project (http://labhamster.sf.net)
## Labhamster is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License as
## published by the Free Software Foundation, either version 3 of the
## License, or (at your option) any later version.

## Labhamster is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU Affero General Public License for more details.

## You should have received a copy of the GNU Affero General Public
## License along with labhamster. If not, see <http://www.gnu.org/licenses/>.
"""
Django settings for labhamstersite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'dgzk#65d^1m702%+0mq^$i7-0e6qke^l#2l&+)=#dfl3@or08d'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
'labhamster',
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'labhamstersite.urls'

WSGI_APPLICATION = 'labhamstersite.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'America/Montreal'

USE_I18N = True

USE_L10N = False

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

STATIC_URL = '/static/'
12 changes: 12 additions & 0 deletions labhamstersite/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Examples:
# url(r'^$', 'labhamstersite.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),

url(r'^admin/', include(admin.site.urls)),
)
14 changes: 14 additions & 0 deletions labhamstersite/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
WSGI config for labhamstersite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "labhamstersite.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
19 changes: 8 additions & 11 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
sys.exit(1)

import settings
import os
import sys
import labhamstersite

if __name__ == "__main__":
execute_manager(settings)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "labhamstersite.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
2 changes: 2 additions & 0 deletions settings_localexample.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
'''
Alternative settings file geared towards a postgresql + apache installation.
Modify and use instead of the default settings.py.
NOTE: This is based on a django 1.3.1 settings.py;
'''

DEBUG = True
Expand Down
Loading

0 comments on commit fa5fb56

Please sign in to comment.