Merged in heroku (pull request #27)

Update master brance to Heroku
This commit is contained in:
Tom Price
2015-04-25 16:16:51 +01:00
6 changed files with 90 additions and 9 deletions

1
Procfile Normal file
View File

@@ -0,0 +1 @@
web: gunicorn PyRIGS.wsgi --log-file -

View File

@@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
@@ -19,13 +21,13 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = 'gxhy(a#5mhp289_=6xx$7jh=eh$ymxg^ymc+di*0c*geiu3p_e'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['*']
INTERNAL_IPS = ['127.0.0.1', '10.20.30.20']
INTERNAL_IPS = ['127.0.0.1']
# Application definition
@@ -82,6 +84,44 @@ DATABASES = {
}
}
if not DEBUG:
import dj_database_url
DATABASES['default'] = dj_database_url.config()
# Logging
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': ('%(asctime)s [%(process)d] [%(levelname)s] ' +
'pathname=%(pathname)s lineno=%(lineno)s ' +
'funcname=%(funcName)s %(message)s'),
'datefmt': '%Y-%m-%d %H:%M:%S'
},
'simple': {
'format': '%(levelname)s %(message)s'
}
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'logging.NullHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
},
'loggers': {
'RIGS': {
'handlers': ['console'],
'level': 'INFO',
}
}
}
# User system
AUTH_USER_MODEL = 'RIGS.Profile'
@@ -95,11 +135,13 @@ ACCOUNT_ACTIVATION_DAYS = 7
EMAILER_TEST = False
if not DEBUG or EMAILER_TEST:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'server.techost.co.uk'
EMAIL_HOST = 'mail.nottinghamtec.co.uk'
EMAIL_PORT = 465
EMAIL_HOST_USER = 'tec'
EMAIL_HOST_PASSWORD = 's7m4R3X'
DEFAULT_FROM_EMAIL = 'rigs@nottinghamtec.co.uk'
EMAIL_HOST_USER = 'pyrigs@nottinghamtec.co.uk'
EMAIL_HOST_PASSWORD = 'N_dF9T&dD(Th'
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = 'pyrigs@nottinghamtec.co.uk'
else:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

View File

@@ -6,9 +6,10 @@ 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PyRIGS.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
from dj_static import Cling
application = Cling(get_wsgi_application())

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('RIGS', '0021_auto_20150420_1155'),
]
operations = [
migrations.AlterField(
model_name='event',
name='collector',
field=models.CharField(max_length=255, null=True, verbose_name=b'Collected by', blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='event',
name='purchase_order',
field=models.CharField(max_length=255, null=True, verbose_name=b'PO', blank=True),
preserve_default=True,
),
]

View File

@@ -57,7 +57,7 @@ urlpatterns = patterns('',
name='venue_update'),
# Rigboard
url(r'^rigboard/$', rigboard.RigboardIndex.as_view(), name='rigboard'),
url(r'^rigboard/$', login_required(rigboard.RigboardIndex.as_view()), name='rigboard'),
url(r'^rigboard/calendar/$', login_required()(rigboard.WebCalendar.as_view()), name='web_calendar'),
url(r'^rigboard/archive/$', RedirectView.as_view(pattern_name='event_archive')),

View File

@@ -345,6 +345,7 @@ def main():
# [x.start() for x in processs]
# # Wait for all processs to finish
# [x.join() for x in processs]
import_users()
import_people(True)
import_organisations(True)
@@ -354,8 +355,18 @@ def main():
import_rigs(True)
import_eventitem(True)
import_invoices(True)
# Do this before doing non rigs else it gets ugly
sql = "SELECT setval(\'\"RIGS_%s_id_seq\"\', (SELECT MAX(id) FROM \"RIGS_%s\"));" % ('event', 'event')
cursor = connections['default'].cursor()
cursor.execute(sql)
import_nonrigs(False)
sequences = ['profile', 'person', 'organisation', 'vatrate', 'venue', 'event', 'eventitem', 'invoice', 'payment']
for seq in sequences:
sql = "SELECT setval(\'\"RIGS_%s_id_seq\"\', (SELECT MAX(id) FROM \"RIGS_%s\"));" % (seq, seq)
cursor = connections['default'].cursor()
cursor.execute(sql)
if __name__ == "__main__":
main()