예제 #1
0
def setup_web_files(hars, output_dir):
  from jinja2 import Environment, FileSystemLoader
  env = Environment(loader = FileSystemLoader('.'))
  template_input = env.get_template('index-template.html')
  output_file = open(filejoin(output_dir, 'index.html'), 'w')
  template_input.stream(hars = hars, genome_url_prefixes = GENOME_URL_PREFIXES).dump(output_file)
  output_file.close()

  shutil.copyfile('style.css', filejoin(output_dir, 'style.css'))
예제 #2
0
def setup_web_files(hars, output_dir):
    from jinja2 import Environment, FileSystemLoader
    env = Environment(loader=FileSystemLoader('.'))
    template_input = env.get_template('index-template.html')
    output_file = open(filejoin(output_dir, 'index.html'), 'w')
    template_input.stream(
        hars=hars, genome_url_prefixes=GENOME_URL_PREFIXES).dump(output_file)
    output_file.close()

    shutil.copyfile('style.css', filejoin(output_dir, 'style.css'))
예제 #3
0
def convert_imgs(hars, output_dir):
  img_dir = filejoin(output_dir, 'imgs')
  os.mkdir(img_dir)
  for har in hars:
    har_dir = filejoin(img_dir, str(har))
    if not isdir(har_dir): os.mkdir(har_dir)
    for species in hars[har]['species']:
      species_dir = filejoin(har_dir, species)
      if not isdir(species_dir): os.mkdir(species_dir)
      for img_num, original_path in hars[har]['species'][species]['imgs'].iteritems():
        target_path = filejoin(species_dir, str(img_num))
        convert_img(original_path, target_path)
예제 #4
0
def convert_imgs(hars, output_dir):
    img_dir = filejoin(output_dir, 'imgs')
    os.mkdir(img_dir)
    for har in hars:
        har_dir = filejoin(img_dir, str(har))
        if not isdir(har_dir): os.mkdir(har_dir)
        for species in hars[har]['species']:
            species_dir = filejoin(har_dir, species)
            if not isdir(species_dir): os.mkdir(species_dir)
            for img_num, original_path in hars[har]['species'][species][
                    'imgs'].iteritems():
                target_path = filejoin(species_dir, str(img_num))
                convert_img(original_path, target_path)
예제 #5
0
def find_imgs(hars, img_dir_path, skipped):
  for dirname, _, filenames in os.walk(img_dir_path):
    for filename in filenames:
      filepath = filejoin(dirname, filename)
      match = ALLOWED_IMG_RE.match(filename)
      if not match:
        continue
      har = int(match.group('har'))
      if not har in hars:
        if skipped: print "Skipping -- unknown HAR '%d': %s" % (har, filepath)
        continue
      img_species = match.group('species')
      species = IMG_SPECIES_TO_CSV.get(img_species)
      if not species:
        if skipped: print "Skipping -- unknown species '%s': %s" % (species, filepath)
        continue
      img_num = int(match.group('num'))
      hars[har]['species'][species]['imgs'][img_num] = filepath
예제 #6
0
def find_imgs(hars, img_dir_path, skipped):
    for dirname, _, filenames in os.walk(img_dir_path):
        for filename in filenames:
            filepath = filejoin(dirname, filename)
            match = ALLOWED_IMG_RE.match(filename)
            if not match:
                continue
            har = int(match.group('har'))
            if not har in hars:
                if skipped:
                    print "Skipping -- unknown HAR '%d': %s" % (har, filepath)
                continue
            img_species = match.group('species')
            species = IMG_SPECIES_TO_CSV.get(img_species)
            if not species:
                if skipped:
                    print "Skipping -- unknown species '%s': %s" % (species,
                                                                    filepath)
                continue
            img_num = int(match.group('num'))
            hars[har]['species'][species]['imgs'][img_num] = filepath
예제 #7
0
# 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 = False

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = False

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = filejoin(SITE_DIR, 'media')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = urljoin(SITE_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: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = urljoin(SITE_URL, 'static/')
예제 #8
0
# 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 = False

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = False

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = filejoin(SITE_DIR, 'media')
#MEDIA_ROOT = os.path.join(SITE_DIR, 'media')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = urljoin(SITE_URL, 'media/')
#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: "/home/media/media.lawrence.com/static/"
#STATIC_ROOT = ''
STATIC_ROOT = SITE_DIR + "/static/"
예제 #9
0
# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
# (This setting is deprecated since Django 1.4--Samad)
# ADMIN_MEDIA_PREFIX = urljoin(SITE_URL, 'static/admin/')

ALLOWED_HOSTS = ['*']

if DJANGO_STATIC_AND_MEDIA:
	# 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.
	    filejoin(SITE_DIR, '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',
	)

# 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',
예제 #10
0
# settings for xapian indexing

from os.path import join as filejoin
try:
    from conf.paths import SITE_DIR
except ImportError:
    from conf.mock import SITE_DIR
XAPIAN_INDICES_DIR = filejoin(SITE_DIR, 'xapian_indices')
예제 #11
0
# settings for GeoIP

from os.path import join as filejoin, abspath
from paths import SITE_DIR

# the download/geolite directory has a Makefile that automatically downloads
# the latest GeoLite data files
GEOIP_PATH = abspath(filejoin(SITE_DIR, 'download', 'geolite'))

# the absolute path to the GeoIP library file; ends in *.dylib on Mac, or *.a on Linux
GEOIP_LIBRARY_PATH = '' 
예제 #12
0
"""
WSGI config for Cytoscape AppStore 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.8/howto/deployment/wsgi/
"""

import os
import sys
from os.path import join as filejoin
from django.core.wsgi import get_wsgi_application


SITE_PARENT_DIR = '/var/www'
SITE_DIR = filejoin(SITE_PARENT_DIR, 'appstore')

sys.path.append(SITE_PARENT_DIR)
sys.path.append(SITE_DIR)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "appstore.settings.local")

application = get_wsgi_application()
예제 #13
0
# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
# (This setting is deprecated since Django 1.4--Samad)
# ADMIN_MEDIA_PREFIX = urljoin(SITE_URL, 'static/admin/')

ALLOWED_HOSTS = ['*']

if DJANGO_STATIC_AND_MEDIA:
    # 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.
        filejoin(SITE_DIR, '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',
    )

# 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',
)
예제 #14
0
# 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 = False

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = False

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = filejoin(SITE_DIR, 'media')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = urljoin(SITE_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: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = urljoin(SITE_URL, 'static/')