local_settings, use south
This commit is contained in:
parent
77f9d108d0
commit
1a069543ee
6 changed files with 198 additions and 17 deletions
|
@ -4,3 +4,5 @@ media
|
||||||
media/posters
|
media/posters
|
||||||
host_settings
|
host_settings
|
||||||
dev.sqlite
|
dev.sqlite
|
||||||
|
local_settings.py
|
||||||
|
secret.txt
|
||||||
|
|
78
lookup/migrations/0001_initial.py
Normal file
78
lookup/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from south.db import db
|
||||||
|
from django.db import models
|
||||||
|
from oxdata.lookup.models import *
|
||||||
|
|
||||||
|
class Migration:
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
|
||||||
|
# Adding model 'MovieId'
|
||||||
|
db.create_table('lookup_movieid', (
|
||||||
|
('id', orm['lookup.MovieId:id']),
|
||||||
|
('created', orm['lookup.MovieId:created']),
|
||||||
|
('modified', orm['lookup.MovieId:modified']),
|
||||||
|
('title', orm['lookup.MovieId:title']),
|
||||||
|
('year', orm['lookup.MovieId:year']),
|
||||||
|
('director', orm['lookup.MovieId:director']),
|
||||||
|
('series_title', orm['lookup.MovieId:series_title']),
|
||||||
|
('episode_title', orm['lookup.MovieId:episode_title']),
|
||||||
|
('season', orm['lookup.MovieId:season']),
|
||||||
|
('episode', orm['lookup.MovieId:episode']),
|
||||||
|
('oxdb_id', orm['lookup.MovieId:oxdb_id']),
|
||||||
|
('imdb_id', orm['lookup.MovieId:imdb_id']),
|
||||||
|
('amg_id', orm['lookup.MovieId:amg_id']),
|
||||||
|
('wikipedia_id', orm['lookup.MovieId:wikipedia_id']),
|
||||||
|
('criterion_id', orm['lookup.MovieId:criterion_id']),
|
||||||
|
('impawards_id', orm['lookup.MovieId:impawards_id']),
|
||||||
|
))
|
||||||
|
db.send_create_signal('lookup', ['MovieId'])
|
||||||
|
|
||||||
|
# Adding model 'Karagarga'
|
||||||
|
db.create_table('lookup_karagarga', (
|
||||||
|
('id', orm['lookup.Karagarga:id']),
|
||||||
|
('movie_id', orm['lookup.Karagarga:movie_id']),
|
||||||
|
('karagarga_id', orm['lookup.Karagarga:karagarga_id']),
|
||||||
|
))
|
||||||
|
db.send_create_signal('lookup', ['Karagarga'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
|
||||||
|
# Deleting model 'MovieId'
|
||||||
|
db.delete_table('lookup_movieid')
|
||||||
|
|
||||||
|
# Deleting model 'Karagarga'
|
||||||
|
db.delete_table('lookup_karagarga')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
models = {
|
||||||
|
'lookup.karagarga': {
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'karagarga_id': ('django.db.models.fields.IntegerField', [], {'unique': 'True'}),
|
||||||
|
'movie_id': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'karagarga_ids'", 'to': "orm['lookup.MovieId']"})
|
||||||
|
},
|
||||||
|
'lookup.movieid': {
|
||||||
|
'amg_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'criterion_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'director': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
|
||||||
|
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'episode_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'imdb_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '7', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'impawards_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'oxdb_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '42', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'series_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
|
||||||
|
'title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
|
||||||
|
'wikipedia_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'year': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '4', 'blank': 'True'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['lookup']
|
0
lookup/migrations/__init__.py
Normal file
0
lookup/migrations/__init__.py
Normal file
90
poster/migrations/0001_initial.py
Normal file
90
poster/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from south.db import db
|
||||||
|
from django.db import models
|
||||||
|
from oxdata.poster.models import *
|
||||||
|
|
||||||
|
class Migration:
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
|
||||||
|
# Adding model 'PosterCache'
|
||||||
|
db.create_table('poster_postercache', (
|
||||||
|
('id', orm['poster.PosterCache:id']),
|
||||||
|
('created', orm['poster.PosterCache:created']),
|
||||||
|
('modified', orm['poster.PosterCache:modified']),
|
||||||
|
('movie_id', orm['poster.PosterCache:movie_id']),
|
||||||
|
('url', orm['poster.PosterCache:url']),
|
||||||
|
('site', orm['poster.PosterCache:site']),
|
||||||
|
('site_id', orm['poster.PosterCache:site_id']),
|
||||||
|
('image', orm['poster.PosterCache:image']),
|
||||||
|
('failed', orm['poster.PosterCache:failed']),
|
||||||
|
))
|
||||||
|
db.send_create_signal('poster', ['PosterCache'])
|
||||||
|
|
||||||
|
# Adding model 'Poster'
|
||||||
|
db.create_table('poster_poster', (
|
||||||
|
('id', orm['poster.Poster:id']),
|
||||||
|
('created', orm['poster.Poster:created']),
|
||||||
|
('modified', orm['poster.Poster:modified']),
|
||||||
|
('movie_id', orm['poster.Poster:movie_id']),
|
||||||
|
('poster', orm['poster.Poster:poster']),
|
||||||
|
('upload', orm['poster.Poster:upload']),
|
||||||
|
('oxdb', orm['poster.Poster:oxdb']),
|
||||||
|
))
|
||||||
|
db.send_create_signal('poster', ['Poster'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
|
||||||
|
# Deleting model 'PosterCache'
|
||||||
|
db.delete_table('poster_postercache')
|
||||||
|
|
||||||
|
# Deleting model 'Poster'
|
||||||
|
db.delete_table('poster_poster')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
models = {
|
||||||
|
'lookup.movieid': {
|
||||||
|
'amg_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'criterion_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'director': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
|
||||||
|
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'episode_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'imdb_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '7', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'impawards_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'oxdb_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '42', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'series_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
|
||||||
|
'title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1000', 'blank': 'True'}),
|
||||||
|
'wikipedia_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'year': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '4', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'poster.poster': {
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movie_id': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'poster'", 'to': "orm['lookup.MovieId']"}),
|
||||||
|
'oxdb': ('django.db.models.fields.files.ImageField', [], {'max_length': '255'}),
|
||||||
|
'poster': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['poster.PosterCache']", 'blank': 'True'}),
|
||||||
|
'upload': ('django.db.models.fields.files.ImageField', [], {'max_length': '255'})
|
||||||
|
},
|
||||||
|
'poster.postercache': {
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'failed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '255'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movie_id': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'postercache'", 'to': "orm['lookup.MovieId']"}),
|
||||||
|
'site': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'site_id': ('django.db.models.fields.CharField', [], {'max_length': '42'}),
|
||||||
|
'url': ('django.db.models.fields.CharField', [], {'max_length': '1024'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['poster']
|
0
poster/migrations/__init__.py
Normal file
0
poster/migrations/__init__.py
Normal file
45
settings.py
45
settings.py
|
@ -4,7 +4,7 @@
|
||||||
import os
|
import os
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
|
||||||
PROJECT_PATH = os.path.normpath(os.path.dirname(__file__))
|
PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
@ -41,10 +41,10 @@ USE_I18N = True
|
||||||
|
|
||||||
# Absolute path to the directory that holds media.
|
# Absolute path to the directory that holds media.
|
||||||
# Example: "/home/media/media.lawrence.com/"
|
# Example: "/home/media/media.lawrence.com/"
|
||||||
MEDIA_ROOT = join(PROJECT_PATH, 'media')
|
MEDIA_ROOT = join(PROJECT_ROOT, 'media')
|
||||||
STATIC_ROOT = join(PROJECT_PATH, 'static')
|
STATIC_ROOT = join(PROJECT_ROOT, 'static')
|
||||||
DATA_ROOT = join(PROJECT_PATH, 'data')
|
DATA_ROOT = join(PROJECT_ROOT, 'data')
|
||||||
CACHE_ROOT = join(PROJECT_PATH, 'cache')
|
CACHE_ROOT = join(PROJECT_ROOT, 'cache')
|
||||||
|
|
||||||
os.environ['oxCACHE'] = CACHE_ROOT
|
os.environ['oxCACHE'] = CACHE_ROOT
|
||||||
|
|
||||||
|
@ -59,9 +59,6 @@ MEDIA_URL = '/media/'
|
||||||
# Examples: "http://foo.com/media/", "/media/".
|
# Examples: "http://foo.com/media/", "/media/".
|
||||||
ADMIN_MEDIA_PREFIX = '/admin/media/'
|
ADMIN_MEDIA_PREFIX = '/admin/media/'
|
||||||
|
|
||||||
# Make this unique, and don't share it with anybody.
|
|
||||||
SECRET_KEY = '8n+5je$*h3d++v)o65oji)eq6ufm*z6(_i(z7gsu+eyp47d+24'
|
|
||||||
|
|
||||||
# List of callables that know how to import templates from various sources.
|
# List of callables that know how to import templates from various sources.
|
||||||
TEMPLATE_LOADERS = (
|
TEMPLATE_LOADERS = (
|
||||||
'django.template.loaders.filesystem.load_template_source',
|
'django.template.loaders.filesystem.load_template_source',
|
||||||
|
@ -78,7 +75,7 @@ MIDDLEWARE_CLASSES = (
|
||||||
ROOT_URLCONF = 'oxdata.urls'
|
ROOT_URLCONF = 'oxdata.urls'
|
||||||
|
|
||||||
TEMPLATE_DIRS = (
|
TEMPLATE_DIRS = (
|
||||||
join(PROJECT_PATH, 'templates'),
|
join(PROJECT_ROOT, 'templates'),
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
|
@ -88,6 +85,7 @@ INSTALLED_APPS = (
|
||||||
'django.contrib.sites',
|
'django.contrib.sites',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.humanize',
|
'django.contrib.humanize',
|
||||||
|
'south',
|
||||||
|
|
||||||
'oxdata.lookup',
|
'oxdata.lookup',
|
||||||
'oxdata.poster',
|
'oxdata.poster',
|
||||||
|
@ -95,13 +93,26 @@ INSTALLED_APPS = (
|
||||||
|
|
||||||
LOGIN_REDIRECT_URL='/'
|
LOGIN_REDIRECT_URL='/'
|
||||||
|
|
||||||
|
#overwrite default settings with local settings
|
||||||
try:
|
try:
|
||||||
import socket
|
from local_settings import *
|
||||||
# hostname = socket.gethostname().replace('.','_')
|
except ImportError:
|
||||||
# exec "from host_settings.%s import *" % hostname
|
pass
|
||||||
local_settings_module = socket.gethostname().split(".")[0]
|
|
||||||
if local_settings_module:
|
# Make this unique, creates random key first at first time.
|
||||||
execfile(os.path.join(PROJECT_PATH, "host_settings", "%s.py" % local_settings_module))
|
try:
|
||||||
except ImportError, e:
|
SECRET_KEY
|
||||||
raise e
|
except NameError:
|
||||||
|
SECRET_FILE = os.path.join(PROJECT_ROOT, 'secret.txt')
|
||||||
|
try:
|
||||||
|
SECRET_KEY = open(SECRET_FILE).read().strip()
|
||||||
|
except IOError:
|
||||||
|
try:
|
||||||
|
from random import choice
|
||||||
|
SECRET_KEY = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
|
||||||
|
secret = file(SECRET_FILE, 'w')
|
||||||
|
secret.write(SECRET_KEY)
|
||||||
|
secret.close()
|
||||||
|
except IOError:
|
||||||
|
Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue