Merge branch 'cccs-web-master'

This commit is contained in:
Roberto Rosario
2014-07-11 00:33:12 -04:00
13 changed files with 147 additions and 99 deletions

2
.gitignore vendored
View File

@@ -17,4 +17,6 @@ gpg_home/
/venv/
.coverage
/dist/
.idea/
static_collected/
*egg-info*

View File

@@ -0,0 +1,31 @@
# invoke gunicorn using
# 'gunicorn -c <this_file> <project_module>.wsgi:application
import os
import multiprocessing
from django.conf import settings
bind = settings.GUNICORN_BIND
workers = multiprocessing.cpu_count() * 2 + 1
preload_app = True
chdir = settings.BASE_DIR
user = settings.PROCESS_USER
group = user
log_dir = os.path.join(
os.path.dirname(settings.BASE_DIR), 'gunicorn_logs', settings.PROCESS_NAME)
if not os.path.isdir(log_dir):
os.makedirs(log_dir)
import pwd
import grp
os.chown(log_dir,
pwd.getpwnam(user).pw_uid,
grp.getgrnam(group).gr_gid)
accesslog = os.path.join(log_dir, 'access.log')
errorlog = os.path.join(log_dir, 'error.log')
proc_name = settings.PROCESS_NAME

34
contrib/nginx/nginx.conf Normal file
View File

@@ -0,0 +1,34 @@
server {
listen 80;
server_name mayan.crossculturalconsult.com www.mayan.crossculturalconsult.com;
access_log /var/log/nginx/mayan.crossculturalconsult.com.access.log;
error_log /var/log/nginx/mayan.crossculturalconsult.com.error.log;
root /home/mayan/production/;
location /static/ {
alias /home/mayan/production/static_collected/;
}
location /media/ {
alias /home/mayan/production/media/;
}
location = /favicon.ico {
alias /home/mayan/production/media/favicon.ico;
}
location = /robots.txt {
alias /home/mayan/production/media/robots.txt;
}
location / {
proxy_pass http://127.0.0.1:8731;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
}
allow all;
}

View File

@@ -0,0 +1,10 @@
#!/bin/bash
# Run the gunicorn service
# Make sure we're in the right virtual env and location
source /home/mayan/.virtualenvs/production/bin/activate
source /home/mayan/.virtualenvs/production/bin/postactivate
cd /home/mayan/production
exec gunicorn -c /home/mayan/production/deploy/gunicorn.conf.py mayan.wsgi:application

View File

@@ -0,0 +1,10 @@
start on started rc
stop on stopped rc
respawn
respawn limit 3 5
setuid mayan
setgid mayan
exec /home/mayan/production/deploy/production/service_demon.sh

View File

@@ -1,16 +0,0 @@
import os
from mayan.settings import *
# Production database settings
#
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': '<DB_NAME>',
#
# }
# }
# Production file locations (document_storage, gpg_home, image_cache)
# SITE_ROOT = '/local/mayan_files/

View File

@@ -1,5 +1,5 @@
"""
Django settings for testproject project.
Django settings for Mayan EDMS project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
@@ -10,19 +10,15 @@ https://docs.djangoproject.com/en/1.6/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import sys
ugettext = lambda s: s
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
SITE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
_file_path = os.path.abspath(os.path.dirname(__file__)).split('/')
BASE_DIR = SITE_ROOT = '/'.join(_file_path[0:-2])
# 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 = 'om^a(i8^6&h+umbd2%pt91cj!qu_@oztw117rgxmn(n2lp^*c!'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@@ -30,11 +26,10 @@ TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
# Django
#Django
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
@@ -44,7 +39,7 @@ INSTALLED_APPS = (
'django.contrib.admindocs',
'django.contrib.comments',
'django.contrib.staticfiles',
# 3rd party
# 3rd party
'south',
'rest_framework_swagger',
'filetransfers',
@@ -53,7 +48,7 @@ INSTALLED_APPS = (
'compressor',
'rest_framework',
'solo',
# Base generic
# Base generic
'permissions',
'project_setup',
'project_tools',
@@ -61,8 +56,8 @@ INSTALLED_APPS = (
'navigation',
'lock_manager',
'web_theme',
# pagination needs to go after web_theme so that the pagination template
# if found
# pagination needs to go after web_theme so that the pagination template
# if found
'pagination',
'common',
'django_gpg',
@@ -74,7 +69,7 @@ INSTALLED_APPS = (
'scheduler',
'job_processor',
'installation',
# Mayan EDMS
# Mayan EDMS
'storage',
'app_registry',
'folders',
@@ -95,8 +90,8 @@ INSTALLED_APPS = (
'checkouts',
'bootstrap',
'registration',
# Has to be last so the other apps can register it's signals
'signaler',
# Has to be last so the other apps can register it's signals
'signaler'
)
MIDDLEWARE_CLASSES = (
@@ -140,23 +135,15 @@ USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
# Custom settings section
import sys
from django.core.urlresolvers import reverse_lazy
sys.path.append(os.path.join(BASE_DIR, 'apps'))
PROJECT_TITLE = 'Mayan EDMS'
PROJECT_NAME = 'mayan'
ugettext = lambda s: s
LANGUAGES = (
('ar', ugettext('Arabic')),
('bg', ugettext('Bulgarian')),
@@ -184,11 +171,13 @@ LANGUAGES = (
SITE_ID = 1
STATIC_ROOT = os.path.join(SITE_ROOT, 'static/')
STATIC_URL = '/static/'
STATIC_URL = '/%s-static/' % PROJECT_NAME
# Custom settings section
ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
sys.path.append(os.path.join(BASE_DIR, 'mayan', 'apps'))
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
@@ -198,13 +187,6 @@ TEMPLATE_LOADERS = (
)),
)
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
# os.path.join(PROJECT_ROOT, 'templates')
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.i18n',
@@ -216,7 +198,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# other finders..
'compressor.finders.CompressorFinder',
)
@@ -272,42 +253,3 @@ REST_FRAMEWORK = {
'rest_framework.authentication.SessionAuthentication',
)
}
try:
from settings_local import *
except ImportError:
pass
if DEBUG:
INTERNAL_IPS = ('127.0.0.1',)
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
try:
import rosetta
INSTALLED_APPS += ('rosetta',)
except ImportError:
pass
try:
import django_extensions
INSTALLED_APPS += ('django_extensions',)
except ImportError:
pass
try:
import debug_toolbar
# INSTALLED_APPS +=('debug_toolbar',)
except ImportError:
pass
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.debug',)
WSGI_AUTO_RELOAD = True
if 'debug_toolbar' in INSTALLED_APPS:
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
}

View File

@@ -0,0 +1,30 @@
from __future__ import absolute_import
from .base import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = ['*']
INTERNAL_IPS = ('127.0.0.1',)
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader'
)
INSTALLED_APPS += (
'rosetta',
'django_extensions',
'debug_toolbar'
)
# Stop debug toolbar patching! (see https://github.com/django-debug-toolbar/django-debug-toolbar/issues/524)
DEBUG_TOOLBAR_PATCH_SETTINGS = False
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.debug',)
WSGI_AUTO_RELOAD = True
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)

View File

@@ -62,6 +62,12 @@ if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
if 'rosetta' in settings.INSTALLED_APPS:
urlpatterns += patterns('',
url(r'^rosetta/', include('rosetta.urls'), name='rosetta'),
)
urlpatterns += patterns(
'',
url(r'^rosetta/', include('rosetta.urls'), name='rosetta'))
import debug_toolbar
urlpatterns += patterns(
'',
url(r'^__debug__/', include(debug_toolbar.urls)))

View File

@@ -1 +1 @@
-r requirements/production.txt
-r requirements/common.txt

View File

@@ -5,3 +5,4 @@ django-extensions==1.3.8
django-rosetta==0.7.4
transifex-client==0.10
django-debug-toolbar==1.2.1
ipython==2.1.0

View File

@@ -1,2 +0,0 @@
# requirements/production.txt
-r common.txt