Commit 58aa2bb6 authored by MAISSIAT's avatar MAISSIAT
Browse files

Fist commit

parent 59891d5f
include *.txt
recursive-include downloader_django/locale *
recursive-include downloader_django/static *
recursive-include downloader_django/templates *
include settings.py
recursive-include downloader *.py
-i https://pypi.python/org/simple/
-e .
# Django settings for django_downloader project.
from __future__ import with_statement
from pkg_resources import resource_filename as pkg_file
from lxml import etree, objectify
import django
import os
from celery import Celery
import simplejson
# Get settings from environment variables
# -----------------------------------------------------------------------------
if 'DOWNLOADER_WORKSPACE' not in os.environ:
raise Exception('Missing DOWNLOADER_WORKSPACE environment variable.')
if not os.path.exists(os.environ['DOWNLOADER_WORKSPACE']):
raise Exception('Downloader worspace directory %s not found.' % os.environ['DOWNLOADER_WORKSPACE'])
WORKSPACE = os.environ.get('DOWNLOADER_WORKSPACE', '')
if 'DOWNLOADER_APPDATA' not in os.environ:
raise Exception('Missing DOWNLOADER_APPDATA environment variable.')
if not os.path.exists(os.environ['DOWNLOADER_APPDATA']):
raise Exception('Downloader application data directory %s not found.' % os.environ['DOWNLOADER_APPDATA'])
APPDATA = os.environ.get('DOWNLOADER_APPDATA', '')
if 'FELYX_CELERY_CFG' not in os.environ:
raise Exception('Missing FELYX_CELERY_CFG environment variable.')
if not os.path.exists(os.environ['FELYX_CELERY_CFG']):
raise Exception('Felyx Celery configuration file %s not found.' % os.environ['FELYX_CELERY_CFG'])
URL_PREFIX = os.environ.get('URL_PREFIX', '')
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'db/downloader.db', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': '',
'PASSWORD': '',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'UTC'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = 'cache'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = os.path.join(os.path.dirname(__file__), 'static') + '/'
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/%sstatic/' % URL_PREFIX
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
pkg_file('downloader_django', 'static'),
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
LOCALE_PATHS = (
os.path.join(STATIC_ROOT, 'locale')
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 't25jsr7eh9!it09qhw4!^%zg)0&)l3#g^!pyj!#0w+^@2*3x9h'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
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"
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
# Lien vers la page si l'authentification echoue
LOGIN_URL='%saccount/login/' % URL_PREFIX
# Lien vers la page si l'authentification reussi
LOGIN_REDIRECT_URL='%sdownloaderadmin/' % URL_PREFIX
ROOT_URLCONF = 'downloader_django.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'downloader_django.wsgi.application'
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.
pkg_file('downloader_django', 'templates'),
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'downloader_django',
'downloader_django.apps.downloader_admin',
'downloader_django.apps.monitor',
)
# 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,
},
}
}
infile_path = os.path.join(APPDATA, 'controller/sc_path.xml')
with open(infile_path, 'r') as infile:
paths = objectify.parse(infile).getroot()
CONF_PATH= os.path.join(WORKSPACE if paths.downloads_config.get('location') == "workspace" else APPDATA,
str(paths.downloads_config))
WORKSPACE_DOWNLOAD= os.path.join(WORKSPACE if paths.work.get('location') == "workspace" else APPDATA,
str(paths.work))
LOG_PATH = os.path.join(WORKSPACE if paths.process_log_archive.get('location') == "workspace" else APPDATA,
str(paths.process_log_archive))
CACHE_JOB_PATH = os.path.join(WORKSPACE if paths.jobfile.get('location') == "workspace" else APPDATA,
str(paths.jobfile))
CACHE_PROVIDER_PATH = os.path.join(WORKSPACE if paths.providerfile.get('location') == "workspace" else APPDATA,
str(paths.providerfile))
BIN_PATH= str(paths.exec_path)
CACHE_SYNCHRO_PATH = os.path.join(WORKSPACE, 'cache/synchrofile/')
infile_path = os.path.join(APPDATA, 'controller/sc_global.xml')
with open(infile_path, 'r') as infile:
global_config = objectify.parse(infile).getroot()
LOCK_FILE_EXTENSION = global_config.lockfile_extension
# This loads the celery configuration from FELYX_CELERY_CFG file
with open(os.environ['CELERY_CFG'], 'r') as f:
CELERY_CONF = simplejson.loads(f.read())
CELERY = Celery()
CELERY.conf.update(**CELERY_CONF)
# encoding: utf-8
import os
from setuptools import setup
def list_files(module, prefix, resources):
""""""
module_path = os.path.join(os.path.dirname(__file__), module)
l = len(module_path)
path = os.path.join(module_path, prefix)
for root, _, files in os.walk(path):
relative_root = root[(1+l):]
filepaths = map(lambda x: os.path.join(relative_root, x), files)
resources.extend(filepaths)
return resources
files = list_files('downloader_django', 'static', [])
files = list_files('downloader_django', 'locale', files)
files = list_files('downloader_django', 'templates', files)
setup( name="downloader_django"
, version='0.0.0'
, packages=[ 'downloader_django'
, 'downloader_django.common'
, 'downloader_django.common.system'
, 'downloader_django.apps'
, 'downloader_django.apps.downloader_admin'
, 'downloader_django.apps.downloader_admin.util'
, 'downloader_django.apps.monitor'
, 'downloader_django.apps.monitor.util'
, 'downloader_django.templatetags'
]
, scripts=['bin/manage.py']
, url='http://felyx.org'
, author='Sylvain HERLEDAN'
, author_email='sylvain.herledan@ifremer.fr'
, install_requires=[
'sqlalchemy>=0.8.2',
'django>=1.5.4,<1.6',
'lxml',
'elementtree',
'celery>=3.1.19,<3.2',
'simplejson'
]
, package_data={'downloader_django': files
}
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment