Merge branch 'release/0.4.0' into production
* release/0.4.0: add release version in changelog, update conf.py implement new tasks for website hierarchy remove Django dependencies as they are not used add new route 'web' for web server configuration implement viewmixins.StaffOrSelfLoginRequiredMixin
This commit is contained in:
commit
4d2da5229c
19 changed files with 174 additions and 527 deletions
|
@ -1,6 +1,11 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
* :release:`0.4.0 <2015-01-26>`
|
||||
* :feature:`-` implement new tasks create_file_website_hierarchy and
|
||||
delete_file_website_hierarchy
|
||||
* :support:`-` remove unneeded Django dependencies
|
||||
|
||||
* :release:`0.3.0 <2015-01-19>`
|
||||
* :support:`-` refactor osusers.tasks, move to fileservertasks.tasks
|
||||
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
Code documentation
|
||||
==================
|
||||
|
||||
.. index:: Django
|
||||
gvafile is implemented as a set of `Celery`_ tasks.
|
||||
|
||||
gvafile is implemented as `Django`_ project and provides some `Celery`_ tasks.
|
||||
|
||||
.. _Django: https://www.djangoproject.com/
|
||||
.. _Celery: http://www.celeryproject.org/
|
||||
|
||||
|
||||
|
@ -23,57 +20,25 @@ The project module :py:mod:`gvafile`
|
|||
:members:
|
||||
|
||||
|
||||
:py:mod:`urls <gvafile.urls>`
|
||||
-----------------------------
|
||||
|
||||
.. automodule:: gvafile.urls
|
||||
|
||||
|
||||
:py:mod:`exceptions <gvafile.exceptions>`
|
||||
-----------------------------------------
|
||||
|
||||
.. automodule:: gvafile.exceptions
|
||||
|
||||
|
||||
:py:mod:`wsgi <gvafile.wsgi>`
|
||||
-----------------------------
|
||||
|
||||
.. automodule:: gvafile.wsgi
|
||||
:members:
|
||||
|
||||
|
||||
:py:mod:`settings <gvafile.settings>`
|
||||
-------------------------------------
|
||||
|
||||
.. automodule:: gvafile.settings
|
||||
|
||||
:py:mod:`base <gvafile.settings.base>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. automodule:: gvafile.settings.base
|
||||
:members:
|
||||
|
||||
:py:mod:`local <gvafile.settings.local>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. automodule:: gvafile.settings.local
|
||||
|
||||
:py:mod:`production <gvafile.settings.production>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. automodule:: gvafile.settings.production
|
||||
|
||||
:py:mod:`test <gvafile.settings.test>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. automodule:: gvafile.settings.test
|
||||
|
||||
|
||||
:py:mod:`filservertasks` app
|
||||
============================
|
||||
:py:mod:`fileservertasks` app
|
||||
=============================
|
||||
|
||||
.. automodule:: fileservertasks
|
||||
|
||||
|
||||
:py:mod:`tasks <fileservertasks.tasks>`
|
||||
---------------------------------------
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
import sys
|
||||
import os
|
||||
import django
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
|
@ -26,8 +25,6 @@ os.environ['GVAFILE_SERVER_EMAIL'] = 'root@localhost'
|
|||
os.environ['GVAFILE_SFTP_DIRECTORY'] = '/home/www'
|
||||
os.environ['GVAFILE_MAIL_DIRECTORY'] = '/home/mail'
|
||||
|
||||
django.setup()
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
|
@ -62,9 +59,9 @@ copyright = u'2014, 2015 Jan Dittberner'
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.3'
|
||||
version = '0.4'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.3.0'
|
||||
release = '0.4.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -28,8 +28,7 @@ your virtualenv:
|
|||
.. _virtualenv: https://virtualenv.pypa.io/en/latest/
|
||||
|
||||
You will also need to ensure that the virtualenv has the project directory
|
||||
added to the path. Adding the project directory will allow `django-admin.py` to
|
||||
be able to change settings using the `--settings` flag.
|
||||
added to the path.
|
||||
|
||||
.. index:: virtualenvwrapper
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from __future__ import absolute_import, unicode_literals
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
from django.conf import settings
|
||||
from gvafile import settings
|
||||
|
||||
from celery import shared_task
|
||||
from celery.utils.log import get_task_logger
|
||||
|
@ -197,3 +197,74 @@ def delete_file_mailbox(username, mailboxname):
|
|||
raise GVAFileException(
|
||||
"could not remove mailbox %s of user %s" % (mailboxname, username))
|
||||
return mailbox_directory
|
||||
|
||||
|
||||
@shared_task
|
||||
def create_file_website_hierarchy(username, sitename):
|
||||
"""
|
||||
This task creates the directory hierarchy for a website.
|
||||
|
||||
:param str username: the user name
|
||||
:param str sitename: name of the website
|
||||
:return: the directory name
|
||||
:rtype: str
|
||||
|
||||
"""
|
||||
website_directory = os.path.join(
|
||||
_build_sftp_directory_name(username), sitename)
|
||||
try:
|
||||
subprocess.check_output([
|
||||
SUDO_CMD, INSTALL_CMD, '-o', 'root', '-g', username,
|
||||
'-m', '0750', '-d', website_directory], stderr=subprocess.STDOUT)
|
||||
subprocess.check_output([
|
||||
SUDO_CMD, SETFACL_CMD, '-m', 'www-data:--x',
|
||||
website_directory], stderr=subprocess.STDOUT)
|
||||
htmldir = os.path.join(website_directory, 'html')
|
||||
subprocess.check_output([
|
||||
SUDO_CMD, INSTALL_CMD, '-o', username, '-g', username,
|
||||
'-m', '0750', '-d', htmldir], stderr=subprocess.STDOUT)
|
||||
subprocess.check_output([
|
||||
SUDO_CMD, SETFACL_CMD, '-m', 'www-data:r-x',
|
||||
htmldir], stderr=subprocess.STDOUT)
|
||||
subprocess.check_output([
|
||||
SUDO_CMD, SETFACL_CMD, '-d', '-m', 'www-data:r-X',
|
||||
htmldir], stderr=subprocess.STDOUT)
|
||||
tmpdir = os.path.join(website_directory, 'tmp')
|
||||
subprocess.check_output([
|
||||
SUDO_CMD, INSTALL_CMD, '-o', username, '-g', username,
|
||||
'-m', '0750', '-d', tmpdir], stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError:
|
||||
_logger.exception(
|
||||
("could not setup website file hierarchy for user %s's "
|
||||
"website %s"), username, sitename)
|
||||
raise GVAFileException(
|
||||
("could not setup website file hierarchy for user %s's "
|
||||
"website %s") % (username, sitename))
|
||||
return website_directory
|
||||
|
||||
|
||||
@shared_task
|
||||
def delete_file_website_hierarchy(username, sitename):
|
||||
"""
|
||||
This task deletes the website hierarchy recursively.
|
||||
|
||||
:param str username: the user name
|
||||
:param str sitename: name of the website
|
||||
:return: the directory name
|
||||
:rtype: str
|
||||
|
||||
"""
|
||||
website_directory = os.path.join(
|
||||
_build_sftp_directory_name(username), sitename)
|
||||
try:
|
||||
subprocess.check_output([
|
||||
SUDO_CMD, RM_CMD, '-r', '-f', website_directory],
|
||||
stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError:
|
||||
_logger.exception(
|
||||
("could not delete the website file hierarchy of user %s's "
|
||||
"website %s"), username, sitename)
|
||||
raise GVAFileException(
|
||||
("could not delete the website file hierarchy of user %s's "
|
||||
"website %s") % (username, sitename))
|
||||
return website_directory
|
||||
|
|
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||
class GvaRouter(object):
|
||||
|
||||
def route_for_task(self, task, args=None, kwargs=None):
|
||||
for route in ['ldap', 'file', 'mysql', 'pgsql']:
|
||||
for route in ['ldap', 'file', 'mysql', 'pgsql', 'web']:
|
||||
if route in task:
|
||||
return {
|
||||
'exchange': route,
|
||||
|
|
42
gvafile/gvacommon/viewmixins.py
Normal file
42
gvafile/gvacommon/viewmixins.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
"""
|
||||
This module defines mixins for gnuviechadmin views.
|
||||
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.http import HttpResponseForbidden
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from braces.views import LoginRequiredMixin
|
||||
|
||||
|
||||
class StaffOrSelfLoginRequiredMixin(LoginRequiredMixin):
|
||||
"""
|
||||
Mixin that makes sure that a user is logged in and matches the current
|
||||
customer or is a staff user.
|
||||
|
||||
"""
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
if (
|
||||
request.user.is_staff or
|
||||
request.user == self.get_customer_object()
|
||||
):
|
||||
return super(StaffOrSelfLoginRequiredMixin, self).dispatch(
|
||||
request, *args, **kwargs
|
||||
)
|
||||
return HttpResponseForbidden(
|
||||
_('You are not allowed to view this page.')
|
||||
)
|
||||
|
||||
def get_customer_object(self):
|
||||
"""
|
||||
Views based on this mixin have to implement this method to return
|
||||
the customer that must be an object of the same class as the
|
||||
django.contrib.auth user type.
|
||||
|
||||
:return: customer
|
||||
:rtype: settings.AUTH_USER_MODEL
|
||||
|
||||
"""
|
||||
raise NotImplemented("subclass has to implement get_customer_object")
|
|
@ -6,18 +6,10 @@ This module defines the Celery_ app for gvafile.
|
|||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from celery import Celery
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
|
||||
'gvafile.settings.production')
|
||||
|
||||
|
||||
#: The Celery application
|
||||
app = Celery('gvafile')
|
||||
|
||||
app.config_from_object('django.conf:settings')
|
||||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
|
||||
app.config_from_object('gvafile.settings')
|
||||
app.autodiscover_tasks(['fileservertasks'], force=True)
|
||||
|
|
45
gvafile/gvafile/settings.py
Normal file
45
gvafile/gvafile/settings.py
Normal file
|
@ -0,0 +1,45 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# pymode:lint_ignore=E501
|
||||
"""
|
||||
Common settings and globals.
|
||||
|
||||
"""
|
||||
|
||||
from os import environ
|
||||
|
||||
|
||||
def get_env_setting(setting):
|
||||
"""
|
||||
Get the environment setting or return exception.
|
||||
|
||||
:param str setting: name of an environment setting
|
||||
:raises ImproperlyConfigured: if the environment setting is not defined
|
||||
:return: environment setting value
|
||||
:rtype: str
|
||||
"""
|
||||
try:
|
||||
return environ[setting]
|
||||
except KeyError:
|
||||
error_msg = "Set the %s env variable" % setting
|
||||
raise AssertionError(error_msg)
|
||||
|
||||
|
||||
########## CELERY CONFIGURATION
|
||||
CELERY_TIMEZONE = 'Europe/Berlin'
|
||||
CELERY_ENABLE_UTC = True
|
||||
CELERY_RESULT_BACKEND = 'amqp'
|
||||
CELERY_RESULT_PERSISTENT = True
|
||||
CELERY_TASK_RESULT_EXPIRES = None
|
||||
CELERY_ROUTES = (
|
||||
'gvacommon.celeryrouters.GvaRouter',
|
||||
)
|
||||
CELERY_ACCEPT_CONTENT = ['json']
|
||||
CELERY_TASK_SERIALIZER = 'json'
|
||||
CELERY_RESULT_SERIALIZER = 'json'
|
||||
BROKER_URL = get_env_setting('GVAFILE_BROKER_URL')
|
||||
########## END CELERY CONFIGURATION
|
||||
|
||||
########## GVAFILE CONFIGURATION
|
||||
GVAFILE_SFTP_DIRECTORY = get_env_setting('GVAFILE_SFTP_DIRECTORY')
|
||||
GVAFILE_MAIL_DIRECTORY = get_env_setting('GVAFILE_MAIL_DIRECTORY')
|
||||
########## END GVAFILE CONFIGURATION
|
|
@ -1,3 +0,0 @@
|
|||
"""
|
||||
This module contains settings for various environments.
|
||||
"""
|
|
@ -1,293 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# pymode:lint_ignore=E501
|
||||
"""
|
||||
Common settings and globals.
|
||||
|
||||
"""
|
||||
|
||||
from os.path import abspath, basename, dirname, join, normpath
|
||||
from sys import path
|
||||
from os import environ
|
||||
|
||||
# Normally you should not import ANYTHING from Django directly
|
||||
# into your settings, but ImproperlyConfigured is an exception.
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
|
||||
def get_env_setting(setting):
|
||||
"""
|
||||
Get the environment setting or return exception.
|
||||
|
||||
:param str setting: name of an environment setting
|
||||
:raises ImproperlyConfigured: if the environment setting is not defined
|
||||
:return: environment setting value
|
||||
:rtype: str
|
||||
"""
|
||||
try:
|
||||
return environ[setting]
|
||||
except KeyError:
|
||||
error_msg = "Set the %s env variable" % setting
|
||||
raise ImproperlyConfigured(error_msg)
|
||||
|
||||
|
||||
########## PATH CONFIGURATION
|
||||
# Absolute filesystem path to the Django project directory:
|
||||
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
|
||||
|
||||
# Absolute filesystem path to the top-level project folder:
|
||||
SITE_ROOT = dirname(DJANGO_ROOT)
|
||||
|
||||
# Site name:
|
||||
SITE_NAME = basename(DJANGO_ROOT)
|
||||
|
||||
# Add our project to our pythonpath, this way we don't need to type our project
|
||||
# name in our dotted import paths:
|
||||
path.append(DJANGO_ROOT)
|
||||
########## END PATH CONFIGURATION
|
||||
|
||||
|
||||
########## DEBUG CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
||||
DEBUG = False
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
########## END DEBUG CONFIGURATION
|
||||
|
||||
|
||||
########## MANAGER CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
|
||||
ADMINS = (
|
||||
(get_env_setting('GVAFILE_ADMIN_NAME'), get_env_setting('GVAFILE_ADMIN_EMAIL')),
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
|
||||
MANAGERS = ADMINS
|
||||
########## END MANAGER CONFIGURATION
|
||||
|
||||
|
||||
########## DATABASE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': normpath(join(DJANGO_ROOT, 'default.db')),
|
||||
'USER': '',
|
||||
'PASSWORD': '',
|
||||
'HOST': '',
|
||||
'PORT': '',
|
||||
},
|
||||
}
|
||||
########## END DATABASE CONFIGURATION
|
||||
|
||||
|
||||
########## GENERAL CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
|
||||
TIME_ZONE = 'Europe/Berlin'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#language-code
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id
|
||||
SITE_ID = 1
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-i18n
|
||||
USE_I18N = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-l10n
|
||||
USE_L10N = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#use-tz
|
||||
USE_TZ = True
|
||||
########## END GENERAL CONFIGURATION
|
||||
|
||||
|
||||
########## MEDIA CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-root
|
||||
MEDIA_ROOT = normpath(join(SITE_ROOT, 'media'))
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
|
||||
MEDIA_URL = '/media/'
|
||||
########## END MEDIA CONFIGURATION
|
||||
|
||||
|
||||
########## STATIC FILE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-root
|
||||
STATIC_ROOT = normpath(join(SITE_ROOT, 'assets'))
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
|
||||
STATICFILES_DIRS = (
|
||||
normpath(join(SITE_ROOT, 'static')),
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
)
|
||||
########## END STATIC FILE CONFIGURATION
|
||||
|
||||
|
||||
########## SECRET CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
|
||||
# Note: This key should only be used for development and testing.
|
||||
SECRET_KEY = get_env_setting('GVAFILE_SECRETKEY')
|
||||
########## END SECRET CONFIGURATION
|
||||
|
||||
|
||||
########## SITE CONFIGURATION
|
||||
# Hosts/domain names that are valid for this site
|
||||
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = []
|
||||
########## END SITE CONFIGURATION
|
||||
|
||||
|
||||
########## FIXTURE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FIXTURE_DIRS
|
||||
FIXTURE_DIRS = (
|
||||
normpath(join(SITE_ROOT, 'fixtures')),
|
||||
)
|
||||
########## END FIXTURE CONFIGURATION
|
||||
|
||||
|
||||
########## TEMPLATE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.core.context_processors.debug',
|
||||
'django.core.context_processors.i18n',
|
||||
'django.core.context_processors.media',
|
||||
'django.core.context_processors.static',
|
||||
'django.core.context_processors.tz',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'django.core.context_processors.request',
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
|
||||
TEMPLATE_DIRS = (
|
||||
normpath(join(SITE_ROOT, 'templates')),
|
||||
)
|
||||
########## END TEMPLATE CONFIGURATION
|
||||
|
||||
|
||||
########## MIDDLEWARE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#middleware-classes
|
||||
MIDDLEWARE_CLASSES = (
|
||||
# Default Django middleware.
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
########## END MIDDLEWARE CONFIGURATION
|
||||
|
||||
|
||||
########## URL CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf
|
||||
ROOT_URLCONF = '%s.urls' % SITE_NAME
|
||||
########## END URL CONFIGURATION
|
||||
|
||||
|
||||
########## TEST RUNNER CONFIGURATION
|
||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||
########## END TEST RUNNER CONFIGURATION
|
||||
|
||||
|
||||
########## APP CONFIGURATION
|
||||
DJANGO_APPS = (
|
||||
# Default Django apps:
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
# Useful template tags:
|
||||
# 'django.contrib.humanize',
|
||||
|
||||
# Admin panel and documentation:
|
||||
'django.contrib.admin',
|
||||
# 'django.contrib.admindocs',
|
||||
)
|
||||
|
||||
# Apps specific for this project go here.
|
||||
LOCAL_APPS = (
|
||||
'fileservertasks',
|
||||
)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
|
||||
INSTALLED_APPS = DJANGO_APPS + LOCAL_APPS
|
||||
########## END APP CONFIGURATION
|
||||
|
||||
|
||||
########## LOGGING CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging
|
||||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'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,
|
||||
},
|
||||
}
|
||||
}
|
||||
########## END LOGGING CONFIGURATION
|
||||
|
||||
|
||||
########## WSGI CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
|
||||
WSGI_APPLICATION = '%s.wsgi.application' % SITE_NAME
|
||||
########## END WSGI CONFIGURATION
|
||||
|
||||
|
||||
########## GVAFILE CONFIGURATION
|
||||
GVAFILE_SFTP_DIRECTORY = get_env_setting('GVAFILE_SFTP_DIRECTORY')
|
||||
GVAFILE_MAIL_DIRECTORY = get_env_setting('GVAFILE_MAIL_DIRECTORY')
|
||||
########## END GVAFILE CONFIGURATION
|
||||
|
||||
|
||||
########## CELERY CONFIGURATION
|
||||
BROKER_URL = get_env_setting('GVAFILE_BROKER_URL')
|
||||
CELERY_RESULT_BACKEND = 'amqp'
|
||||
CELERY_RESULT_PERSISTENT = True
|
||||
CELERY_TASK_RESULT_EXPIRES = None
|
||||
CELERY_ROUTES = (
|
||||
'gvacommon.celeryrouters.GvaRouter',
|
||||
)
|
||||
CELERY_TIMEZONE = 'Europe/Berlin'
|
||||
CELERY_ENABLE_UTC = True
|
||||
CELERY_ACCEPT_CONTENT = ['json']
|
||||
CELERY_TASK_SERIALIZER = 'json'
|
||||
CELERY_RESULT_SERIALIZER = 'json'
|
||||
########## END CELERY CONFIGURATION
|
|
@ -1,51 +0,0 @@
|
|||
# pymode:lint_ignore=W0401,E501
|
||||
"""
|
||||
Development settings and globals based on :py:mod:`gvafile.settings.base`.
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .base import *
|
||||
|
||||
|
||||
########## DEBUG CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
|
||||
DEBUG = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
########## END DEBUG CONFIGURATION
|
||||
|
||||
|
||||
########## EMAIL CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
########## END EMAIL CONFIGURATION
|
||||
|
||||
|
||||
########## CACHE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
}
|
||||
}
|
||||
########## END CACHE CONFIGURATION
|
||||
|
||||
|
||||
########## TOOLBAR CONFIGURATION
|
||||
# See: http://django-debug-toolbar.readthedocs.org/en/latest/installation.html#explicit-setup
|
||||
INSTALLED_APPS += (
|
||||
'debug_toolbar',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES += (
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
)
|
||||
|
||||
DEBUG_TOOLBAR_PATCH_SETTINGS = False
|
||||
|
||||
# http://django-debug-toolbar.readthedocs.org/en/latest/installation.html
|
||||
INTERNAL_IPS = ('127.0.0.1',)
|
||||
########## END TOOLBAR CONFIGURATION
|
|
@ -1,50 +0,0 @@
|
|||
# pymode:lint_ignore=W0401,E501
|
||||
"""
|
||||
Production settings and globals based on :py:mod:`gvafile.settings.base`.
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .base import *
|
||||
|
||||
########## HOST CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production
|
||||
ALLOWED_HOSTS = get_env_setting('GVAFILE_ALLOWED_HOSTS').split(',')
|
||||
########## END HOST CONFIGURATION
|
||||
|
||||
########## EMAIL CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host
|
||||
#EMAIL_HOST = environ.get('EMAIL_HOST', 'smtp.gmail.com')
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-password
|
||||
#EMAIL_HOST_PASSWORD = environ.get('EMAIL_HOST_PASSWORD', '')
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-host-user
|
||||
#EMAIL_HOST_USER = environ.get('EMAIL_HOST_USER', 'your_email@example.com')
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-port
|
||||
#EMAIL_PORT = environ.get('EMAIL_PORT', 587)
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix
|
||||
EMAIL_SUBJECT_PREFIX = '[%s] ' % SITE_NAME
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-use-tls
|
||||
#EMAIL_USE_TLS = True
|
||||
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email
|
||||
SERVER_EMAIL = get_env_setting('GVAFILE_SERVER_EMAIL')
|
||||
########## END EMAIL CONFIGURATION
|
||||
|
||||
########## DATABASE CONFIGURATION
|
||||
#DATABASES = {}
|
||||
########## END DATABASE CONFIGURATION
|
||||
|
||||
|
||||
########## CACHE CONFIGURATION
|
||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
|
||||
#CACHES = {}
|
||||
########## END CACHE CONFIGURATION
|
|
@ -1,20 +0,0 @@
|
|||
# pymode:lint_ignore=W0401
|
||||
"""
|
||||
Test settings based on :py:mod:`gvafile.settings.base`.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .base import *
|
||||
|
||||
########## IN-MEMORY TEST DATABASE
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": ":memory:",
|
||||
"USER": "",
|
||||
"PASSWORD": "",
|
||||
"HOST": "",
|
||||
"PORT": "",
|
||||
},
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
"""
|
||||
This module defines the main URLConf for gvaldap.
|
||||
|
||||
"""
|
||||
|
||||
from django.conf.urls import patterns, include, url
|
||||
from django.conf import settings
|
||||
|
||||
# Uncomment the next two lines to enable the admin:
|
||||
from django.contrib import admin
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
|
||||
# Uncomment the next line to serve media files in dev.
|
||||
# urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
if settings.DEBUG:
|
||||
import debug_toolbar
|
||||
urlpatterns += patterns('',
|
||||
url(r'^__debug__/', include(debug_toolbar.urls)),
|
||||
)
|
|
@ -1,14 +0,0 @@
|
|||
"""
|
||||
WSGI config for gvafile 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", "gvafile.settings")
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
application = get_wsgi_application()
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gvafile.settings")
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv)
|
|
@ -1,4 +1,3 @@
|
|||
Django==1.7.1
|
||||
amqp==1.4.6
|
||||
bpython==0.13.1
|
||||
anyjson==0.3.3
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Local development dependencies go here
|
||||
-r base.txt
|
||||
coverage==3.7.1
|
||||
django-debug-toolbar==1.2.2
|
||||
Sphinx==1.2.3
|
||||
sqlparse==0.1.14
|
||||
releases==0.7.0
|
||||
|
|
Loading…
Reference in a new issue