Commit 9a136ade authored by Mathieu Courcelles's avatar Mathieu Courcelles

-Add python package requirements

-Fixed setting hard coded link for media
parent 04f4e84e
......@@ -11,3 +11,7 @@ CLMSpipeline/CLMSpipeline_app/site_media/dataset
CLMSpipeline.db
CLMSpipeline/CLMSpipeline_app/migrations
site_media/dataset
CLMSpipeline/settings/local.py
CLMSpipeline/settings/production.py
CLMSpipeline/settings/staging.py
CLMSpipeline/settings/test.py
......@@ -6,7 +6,7 @@
<key>DJANGO_MANAGE_LOCATION</key>
<value>manage.py</value>
<key>DJANGO_SETTINGS_MODULE</key>
<value>CLMSpipeline.settings</value>
<value>CLMSpipeline.settings.local</value>
</pydev_variables_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/CLMSpipeline</path>
......
## Copyright 2012 Mathieu Courcelles
## Mike Tyers's lab / IRIC / Universite de Montreal
# Import standard libraries
import os
# Import Django related libraries
from django.core.exceptions import ImproperlyConfigured
# Import third party libraries
from unipath import Path
PROJECT_DIR = Path(__file__).ancestor(3)
# Code from book Two scoops of Django
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
def get_env_variable(var_name):
""" Get the environment variable or return exception """
try:
return os.environ[var_name]
except KeyError:
error_msg = "Set the %s environment variable" % var_name
raise ImproperlyConfigured(error_msg)
# Django settings for CLMSpipeline project.
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Mathieu Courcelles', 'mathieu.courcelles@umontreal.ca'),
)
MANAGERS = ADMINS
# 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 = 'America/Montreal'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
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 = PROJECT_DIR.child('site_media')
#MEDIA_ROOT = 'C:/Users/Mathieu/Documents/Aptana Studio 3 Workspace/CLMSpipeline/site_media/'
# 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 = PROJECT_DIR.child("static")
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
# 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.
#PROJECT_DIR.child("assets"),
)
# 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',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = get_env_variable("SECRET_KEY")
# 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',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'CLMSpipeline.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'CLMSpipeline.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.
#PROJECT_DIR.child("templates"),
)
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.request",
"django.core.context_processors.i18n",
'django.contrib.messages.context_processors.messages',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Visual enhancment
'grappelli.dashboard',
'grappelli',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
# Schema migration
'south',
# CLMSpipeline app
'CLMSpipeline.CLMSpipeline_app',
)
# 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,
},
}
}
GRAPPELLI_ADMIN_TITLE = 'CLSMS Pipeline - Database frontend admin'
GRAPPELLI_INDEX_DASHBOARD = 'CLMSpipeline.dashboard.CustomIndexDashboard'
......@@ -8,9 +8,10 @@ import os
from django.conf.urls import patterns, include, url
from django.contrib import admin
# Import project libraries
from settings import MEDIA_ROOT
from django.conf import settings
for x in range(1,1000):
print settings.MEDIA_ROOT
admin.autodiscover()
......@@ -27,5 +28,5 @@ urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^grappelli/', include('grappelli.urls')),
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': os.path.dirname(MEDIA_ROOT)}),
{'document_root': os.path.dirname(settings.MEDIA_ROOT + '/')}),
)
Python requirements can be installed this way:
pip install -r requirements/local.txt
or
pip install -r requirements/production.txt
......@@ -3,7 +3,7 @@ import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CLMSpipeline.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE")
from django.core.management import execute_from_command_line
......
Django==1.5.1
MySQL-python==1.2.4
django-grappelli==2.4.5
South==0.7.5
Unipath==1.0
\ No newline at end of file
-r base.txt # includes the base.txt requirements file
\ No newline at end of file
-r base.txt # includes the base.txt requirements file
\ No newline at end of file
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