Example #1
0
def builder_inited(app):
    """Define certain settings
    """
    mydir = Path(__file__).parent.child('static').absolute()
    app.config.html_static_path.append(mydir)
    app.config.html_logo = mydir.child('logo_web3.png')
    app.config.html_favicon = mydir.child('favicon.ico')
Example #2
0
def environment(**options):
    queryfinder = QueryFinder()

    searchpath =[]
    staticdirs = []

    sites = settings.SHEER_SITES
    for site in sites:
        site_path = Path(site)
        searchpath.append(site_path)
        searchpath.append(site_path.child('_includes'))
        searchpath.append(site_path.child('_layouts'))
        staticdirs.append(site_path.child('static'))

    options['loader'].searchpath += searchpath
    settings.STATICFILES_DIRS = staticdirs

    env = SheerlikeEnvironment(**options)
    env.globals.update({
        'static': staticfiles_storage.url,
        'url_for':url_for,
        'url': reverse,
        'queries': queryfinder,
        'more_like_this': more_like_this,
        'get_document': get_document,
        'selected_filters_for_field': selected_filters_for_field,
        'is_filter_selected': is_filter_selected,
    })
    env.filters.update({
        'date':date_filter
    })
    return env
Example #3
0
 def build_jar(self, outdir, alias):
     flags = '-storepass "`cat ~/.secret/.keystore_password`"'
     flags += ' -tsa http://timestamp.globalsign.com/scripts/timestamp.dll'
     outdir = Path(outdir)
     jarfile = outdir.child(self.jarfile)
     if jarfile.needs_update(self.jarcontent):
         local("jar cvfm %s %s" % (jarfile, ' '.join(self.jarcontent)))
     local("jarsigner %s %s %s" % (flags, jarfile, alias))
     for libfile in self.libjars:
         jarfile = outdir.child(libfile.name)
         if libfile.needs_update([jarfile]):
             libfile.copy(jarfile)
         local("jarsigner %s %s %s" % (flags, jarfile, alias))
Example #4
0
def sphinx_build(builder, docs_dir,
                 cmdline_args=[], language=None, build_dir_cmd=None):
    args = ['sphinx-build', '-b', builder]
    args += cmdline_args
    # ~ args += ['-a'] # all files, not only outdated
    # ~ args += ['-P'] # no postmortem
    # ~ args += ['-Q'] # no output
    # build_dir = docs_dir.child(env.build_dir_name)
    build_dir = Path(env.build_dir_name)
    if language is not None:
        args += ['-D', 'language=' + language]
        # needed in select_lang.html template
        args += ['-A', 'language=' + language]
        if language != env.languages[0]:
            build_dir = build_dir.child(language)
            #~ print 20130726, build_dir
    if env.tolerate_sphinx_warnings:
        args += ['-w', 'warnings_%s.txt' % builder]
    else:
        args += ['-W']  # consider warnings as errors
        # args += ['-vvv']  # increase verbosity
    #~ args += ['-w'+Path(env.root_dir,'sphinx_doctest_warnings.txt')]
    args += ['.', build_dir]
    cmd = ' '.join(args)
    with lcd(docs_dir):
        local(cmd)
    if build_dir_cmd is not None:
        with lcd(build_dir):
            local(build_dir_cmd)
Example #5
0
def add_deployment(directory, name, templates_dir='templates', deployment_dir='deployment', mode=0777):
    """ Adds new deployment if not exists
    """
    context = {
        'datetime': datetime.datetime.now(),
        'name': name,
        'project_name': get_project_name(directory)
    }

    dd, df = get_deployment_info(directory, name)

    if df.exists():
        raise ExistingDeploymentError()

    # create deployments directory
    df.parent.mkdir(parents=True, mode=mode)

    # write deployment file
    df.write_file(
        get_rendered_template('deployment.py', context)
    )
    top_td = Path(__file__).parent.child(templates_dir)
    td = top_td.child(deployment_dir)
    for tf in td.walk():
        if tf.isdir():
            continue
        partitioned = tf.partition(td)
        target = Path(dd, Path(partitioned[2][1:]))
        target_dir = target.parent
        if not target_dir.exists():
            target_dir.mkdir(parents=True, mode=mode)
        tmp = tf.partition(top_td)[2][1:]
        rendered = get_rendered_template(tmp, context)
        target.write_file(rendered)
Example #6
0
def activate_env():
    """ Activates the virtual environment for this project."""

    error_msg = None

    try:
        virtualenv_dir = Path(os.environ['WORKON_HOME'])
    except KeyError:
        error_msg = "Error: 'WORKON_HOME' is not set."

    if error_msg:
        color_init()
        sys.stderr.write(Fore.RED + Style.BRIGHT + error_msg + "\n")
        sys.exit(1)

    filepath = Path(__file__).absolute()
    site_dir = filepath.ancestor(4).components()[-1]
    repo_dir = filepath.ancestor(3).components()[-1]

    # Add the app's directory to the PYTHONPATH
    sys.path.append(filepath.ancestor(2))
    sys.path.append(filepath.ancestor(1))

    # Set manually in environment
    #os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.production'

    if os.environ['DJANGO_SETTINGS_MODULE'] == 'settings.production':
        bin_parent = site_dir
    else:
        bin_parent = repo_dir

    # Activate the virtual env
    activate_env = virtualenv_dir.child(bin_parent, "bin", "activate_this.py")
    execfile(activate_env, dict(__file__=activate_env))
Example #7
0
 def test_dump2py(self):
     for prj in ["lino_book/projects/belref"]:
         p = Path(prj)
         tmp = p.child('tmp').absolute()
         tmp.rmtree()
         self.run_django_admin_command_cd(p, 'dump2py', tmp)
         self.assertEqual(tmp.child('restore.py').exists(), True)
def create_server_config():
    """
    1) Create temporary copy of all files from project_name/server_config
       in project_dir/tmp.
    2) Replace template tags using sed commands to fill missing paths.

    Template variables
    PROJECT_DIR
    PROJECT_NAME
    STAGE
    USER

    """

    extensions = {"dev": "-dev", "stage": "-stage", "prod": "-prod"}

    stage = prompt("Set stage: [dev|stage|prod]: ")
    user = prompt("System username: "******"Nginx ip/domain: ")
    project_name = prompt("Project name: ")
    project_name = project_name + extensions[stage]

    PROJECT_DIR = Path(__file__).parent
    SERVER_CONFIG_FILES_DIR = PROJECT_DIR.child("server_config")

    replace_project_dir = "sed -i 's,PROJECT_DIR,{project_dir},g' {target_file}"
    replace_user = "******"
    replace_project_name = "sed -i 's,PROJECT_NAME,{project_name},g' {target_file}"
    replace_stage = "sed -i 's,STAGE,{stage},g' {target_file}"
    replace_nginx_server_address = "sed -i 's,NGINX_SERVER_ADDRESS,{nginx_server_address},g' {target_file}"

    tmp = PROJECT_DIR.child("tmp")
    local("mkdir {} -p".format(tmp))
    # Copy all server config files to tmp directory
    local("cp {}/* {}".format(SERVER_CONFIG_FILES_DIR, tmp))
    # Change nginx file name
    local("mv {}/nginx {}/{}".format(tmp, tmp, project_name))
    # Change supervisor file name
    local("mv {}/supervisor {}/{}.conf".format(tmp, tmp, project_name))

    for path in tmp.listdir():
        local(replace_project_dir.format(project_dir=PROJECT_DIR, target_file=path))
        local(replace_user.format(user=user, target_file=path))
        local(replace_project_name.format(project_name=project_name, target_file=path))
        local(replace_stage.format(stage=stage, target_file=path))
        local(replace_nginx_server_address.format(nginx_server_address=nginx_server_address, target_file=path))
    print("Finished processing templates for server config.")
Example #9
0
def server(hostname, fqdn, email):
    '''
    Setup a new server: server_setup:hostname,fqdn,email

    Example: server:palmas,palmas.dekode.com.br,[email protected]
    '''
    puts(green('Server setup...'))

    scripts = Path(__file__).parent.child('scripts')

    files = [
        scripts.child('server_setup.sh'),
        scripts.child('postfix.sh'),
        scripts.child('watchdog.sh'),
        scripts.child('uwsgi.sh'),
    ]

    # Choose database
    answer = ask('Which database to install? [P]ostgres, [M]ysql, [N]one ',
        options={
            'P': [scripts.child('pg_hba.conf'), scripts.child('postgresql.sh')],
            'M': [scripts.child('mysql.sh')],
            'N': []})

    files.extend(answer)

    # Create superuser
    if 'Y' == ask('Create superuser? [Y]es or [N]o ', options=('Y', 'N')):
        createuser.run(as_root=True)

    # Upload files and fixes execution mode
    for localfile in files:
        put(localfile, '~/', mirror_local_mode=True)

    run('~root/server_setup.sh %(hostname)s %(fqdn)s %(email)s' % locals())
def savejson(d):
    status = d['status']
    if status.startswith('Pendent'):
        status = 'Pendent'
    carpeta = Path(exportpath, status, d['year'], d['month'])
    carpeta.mkdir(parents=True)
    fpath = carpeta.child('{}.json'.format(d['id']))
    with open(fpath, 'w') as f:
        json.dump(d, f, sort_keys=True, indent=4, separators=(',', ': '))
Example #11
0
def update_catalog_code():
    """Update .po files from .pot file."""
    from lino.core.site import to_locale
    locale_dir = env.locale_dir
    # locale_dir = get_locale_dir()
    if locale_dir is None:
        return
    locale_dir = Path(locale_dir)
    for loc in env.languages:
        if loc != env.languages[0]:
            args = ["python", "setup.py"]
            args += ["update_catalog"]
            args += ["--domain django"]
            #~ args += [ "-d" , locale_dir ]
            args += ["-o", locale_dir.child(loc, 'LC_MESSAGES', 'django.po')]
            args += ["-i", locale_dir.child("django.pot")]
            args += ["-l", to_locale(loc)]
            cmd = ' '.join(args)
            #~ must_confirm(cmd)
            local(cmd)
Example #12
0
    def build_jar(self, ctx, outdir, alias):
        flags = '-storepass "`cat ~/.secret/.keystore_password`"'
        if self.tsa:
            flags += ' -tsa {0}'.format(self.tsa)

        def run_signer(jarfile):
            ctx.run("jarsigner %s %s %s" % (flags, jarfile, alias), pty=True)
            ctx.run("jarsigner -verify %s" % jarfile, pty=True)

        outdir = Path(outdir)
        jarfile = outdir.child(self.jarfile)
        if jarfile.needs_update(self.jarcontent):
            jarcontent = [x.replace("$", r"\$") for x in self.jarcontent]
            ctx.run("jar cvfm %s %s" % (jarfile, ' '.join(jarcontent)), pty=True)
        run_signer(jarfile)
        for libfile in self.libjars:
            jarfile = outdir.child(libfile.name)
            if not jarfile.exists() or libfile.needs_update([jarfile]):
                libfile.copy(jarfile)
            run_signer(jarfile)
Example #13
0
def dev():
    env.hosts = ['77.120.104.181']
    env.user = '******'
    env.port = 2020

    env.shell = '/bin/sh -c'

    env.django_settings_module = 'settings.development'

    project_path = Path('/var/home/dev/multiad/')
    env.env_path = project_path.child('env','bin')
    env.django_path = project_path.child('multiad', 'project')
    gunicorn_wsgi = 'wsgi:application'
    gunicorn_port = 9324
    env.gunicorn_pid = project_path.child('gunicorn.pid')
    settings = 'settings.development'
    worker_count = 3
    cfg_template = '{} -b 127.0.0.1:{} -w{} --max-requests=500 -D --pid {}'
    env.gunicorn_cfg = cfg_template.format(
        gunicorn_wsgi, gunicorn_port, worker_count, env.gunicorn_pid
    )
Example #14
0
def init(directory, deployment_dir='deployment', mode=0777):
    """ Initializes easyfab fabric file along with deployments directory
    """
    directory = Path(directory)
    path = directory.child(deployment_dir)
    if path.exists():
        print 'Deployment directory already exists'
    else:
        path.mkdir(parents=True, mode=mode)

    # write module constuctor
    path.child('__init__.py').write_file("")

    fabfile = directory.child('fabfile.py')
    if fabfile.exists():
        print 'fabfile already exists'
    else:
        rendered = get_rendered_template('fabfile.py', {
            'datetime': datetime.datetime.now()
        })
        fabfile.write_file(rendered)
Example #15
0
def get_project_info_tasks(root_dir):
    "Find the project info for the given directory."
    prj = _PROJECTS_DICT.get(root_dir)
    if prj is None:
        # if no config.py found, add current working directory.
        p = Path().resolve()
        while p:
            if p.child('tasks.py').exists():
                prj = add_project(p)
                break
            p = p.parent
        # raise Exception("No %s in %s" % (root_dir, _PROJECTS_DICT.keys()))
    prj.load_tasks()
    return prj
Example #16
0
 def __get_path(self):
     """
     Gets the path to the backup location
     :return: Unipath if local, string if FTP
     """
     if self.ftp:
         return 'ftp://{}{}'.format(self.ftp_server,
                                    self.__slashes(self.ftp_path))
     else:
         basedir = Path(self.config.get('BASE_DIR', ''))
         backup_dir = basedir.child('alchemydumps')
         if not backup_dir.exists():
             backup_dir.mkdir()
         return self.__slashes(str(backup_dir.absolute()))
Example #17
0
def init_catalog_code():
    """Create code .po files if necessary."""
    from lino.core.site import to_locale
    locale_dir = env.locale_dir
    # locale_dir = get_locale_dir()
    if locale_dir is None:
        return
    locale_dir = Path(locale_dir)
    for loc in env.languages:
        if loc != 'en':
            f = locale_dir.child(loc, 'LC_MESSAGES', 'django.po')
            if f.exists():
                print("Skip %s because file exists." % f)
            else:
                args = ["python", "setup.py"]
                args += ["init_catalog"]
                args += ["--domain django"]
                args += ["-l", to_locale(loc)]
                args += ["-d", locale_dir]
                #~ args += [ "-o" , f ]
                args += ["-i", locale_dir.child('django.pot')]
                cmd = ' '.join(args)
                must_confirm(cmd)
                local(cmd)
Example #18
0
def create_cmdenv(default_cwd="./sandbox", home_env=Path("./sandbox/home").absolute()):
    import trashcli
    from unipath import Path
    from cmd import CommandEnviroment
    from nose import SkipTest

    cmds_aliases={}
    scripts_dir=Path(trashcli.__file__).parent.parent.child("scripts")
    for i in ["trash-list", "trash-put", "trash-empty", "restore-trash"]:
        command=scripts_dir.child(i)
        if not command.exists():
            raise SkipTest("Script not found: `%s'.\nPlease run 'python setup.py develop -s scripts' before." % command)
        else:
            cmds_aliases[i]=command

    return CommandEnviroment(cmds_aliases, default_cwd, {'HOME':home_env})
Example #19
0
def editNameCategory(project, oldName, newName):
	'''
	Rename the category name on the xml files to make aware the flash side that the categories has been modified.
	'''
	folderpath = Path(settings.MEDIA_ROOT).child('stories').child(str(project.id))
	nodes = Node.objects.filter(project__id = project.id)
	for node in nodes:
		nodeXMLFile = folderpath.child('node'+str(node.id)+'.xml')
		tree = ET.parse(nodeXMLFile)
		root = tree.getroot()
		#Find the element and change the name
		for report in root.iter('reporting'):
			for child in report:
				if child.attrib['name'] == oldName:
					child.attrib['name'] = newName
		tree.write(nodeXMLFile)
	return 1
Example #20
0
def init_logging(cluster, verbose, stdout_level=logging.INFO):

    log_dir = Path(__file__).parent.child('logs')
    if not log_dir.exists():
        raise RuntimeError("Missing log path: {}".format(log_dir))

    log_file = "ec2-manager_{}.log".format(cluster)
    log_path = log_dir.child(log_file)

    log.setLevel(logging.DEBUG)

    format = '%(asctime)-15s - ' + cluster + ' - ' \
             + '%(levelname)s - %(name)s - ' \
             + '%(module)s:%(funcName)s:%(lineno)s - %(message)s'
    format=logging.Formatter(format)

    fh = logging.handlers.TimedRotatingFileHandler(log_path, when='D', interval=1)
#    fh.setLevel(logging.DEBUG)
    fh.setFormatter(format)
    log.addHandler(fh)

    if verbose:
        sh = logging.StreamHandler(sys.stdout)
        if stdout_level == logging.DEBUG:
            sh.setFormatter(format)
        else:
            sh.setFormatter(logging.Formatter(
                '%(asctime)-15s - %(levelname)s - ' + cluster + ' - %(message)s'
            ))
        sh.setLevel(stdout_level)
        log.addHandler(sh)
        log.debug("logging to stdout")

    log.debug("logging to %s", log_path)

    if hasattr(settings, 'LOGGLY_TOKEN'):
        cluster_tag = re.sub('\s+', '_', cluster)
        loggly_handler = LogglyHandler(
            settings.LOGGLY_TOKEN,
            settings.LOGGLY_URL,
            tags=cluster_tag + ',' + settings.LOGGLY_TAGS
        )
        log.addHandler(loggly_handler)
        log.debug("Logging to loggly")
Example #21
0
def setup_test_sdist():
    if len(env.demo_databases) == 0:
        return
    ve_path = Path(env.temp_dir, 'test_sdist')
    #~ if ve_path.exists():
    ve_path.rmtree()
    #~ rmtree_after_confirm(ve_path)
    ve_path.mkdir()
    script = ve_path.child('tmp.sh')

    context = dict(name=env.SETUP_INFO['name'], sdist_dir=env.sdist_dir,
                   ve_path=ve_path)
    #~ file(script,'w').write(TEST_SDIST_TEMPLATE % context)
    txt = TEST_SDIST_TEMPLATE % context
    for db in env.demo_databases:
        txt += "django-admin.py test --settings=%s --traceback\n" % db
    script.write_file(txt)
    script.chmod(0o777)
    with lcd(ve_path):
        local(script)
Example #22
0
def requestDeleteCategory(request):
	'''
		API remove the category and check all the xml files created to remove the category from them
	'''
	result = {}
	result["status"] = 'fail'
	if request.method == 'POST':
		try:
			projectId = request.POST['projectid']
			categoryId = request.POST['categoryid']
			folderpath = Path(settings.MEDIA_ROOT).child('stories').child(str(projectId))

			category = Category.objects.get(id = categoryId)

			nodes = Node.objects.filter(project__id = projectId)
			for node in nodes:
				#Delete the report category related with the category to delete
				for attribute in Attribute.objects.filter(node__id = node.id):
					reportCategories = ReportCategory.objects.filter(attribute__id = attribute.id, name = category.name)
					for reportCategory in reportCategories:
						reportCategory.delete()
				#Delete the category in the xml file
				nodeXMLFile = folderpath.child('node'+str(node.id)+'.xml')
				tree = ET.parse(nodeXMLFile)
				root = tree.getroot()
				#Find the element and change the name
				for report in root.iter('reporting'):
					for child in report:
						if child.attrib['name'] == category.name:
							report.remove(child)
							break
				tree.write(nodeXMLFile)
			category.delete() #Remove the category itself
			result["status"] = 'ok'
			resultJson = json.dumps(result)
			return HttpResponse(resultJson,mimetype="application/json")
		except Exception as e:
			result['error'] = str(e)
	resultJson = json.dumps(result)
	return HttpResponse(resultJson,mimetype="application/json")
Example #23
0
    def __init__(self, input_file, output_file=None, binary=None):

        self.width = None
        self.height = None
        self.quality = None
        self.group = None

        if binary:
            self.binary = binary

        self.input_file = Path(input_file)

        input_name = self.input_file.name.rsplit(".", 1)[0]

        if output_file:
            output_file = Path(output_file)
            if output_file.isdir():
                self.output_file = output_file.child(input_name)
            else:
                self.output_file = output_file
        else:
            self.output_file = self.input_file.parent.child(self.input_file.stem)
Example #24
0
def setup():

    system = platform.system()
    if system == "Darwin":
        machine_bin = "/usr/local/bin/docker-machine"
    elif system == "Windows":
        machine_bin = "/bin/docker-machine"
    elif system == "Linux":
        machine_bin = "/usr/local/bin/docker-machine"
    else:
        # unsupported system
        raise NotImplementedError

    home = Path(os.path.expanduser("~"))
    machinery_home = home.child(".machinery")

    # create directories if they don't exist
    if not os.path.exists(machinery_home):
        os.mkdir(machinery_home)

    if not os.path.exists(machinery_home.child("media")):
        os.mkdir(machinery_home.child("media"))


    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "machinery.settings")
    os.environ.setdefault("MACHINERY_DEBUG", "True")
    os.environ.setdefault("MACHINERY_DOCKER_MACHINE_BIN", machine_bin)
    os.environ.setdefault("MACHINERY_DB", machinery_home.child("machinery.sqlite3"))
    os.environ.setdefault("MACHINERY_MEDIA_ROOT", machinery_home.child("media"))

    # run django.setup() to get started
    django.setup()

    # more import hints that rely on a ready django

    # create the cache table and run a migration
    call_command('createcachetable')
    call_command('migrate')
Example #25
0
def objects():

    Project = rt.models.tickets.Project
    Ticket = rt.models.tickets.Ticket
    TicketStates = rt.models.tickets.TicketStates

    prj = Project(name="Lino")
    yield prj

    settings.SITE.loading_from_dump = True

    for ln in TICKETS.splitlines():
        ln = ln.strip()
        if ln:
            a = ln.split(':')
            state = TicketStates.accepted
            a2 = []
            for i in a:
                if '[closed]' in i:
                    state = TicketStates.closed
                i = i.replace('[closed]', '')
                a2.append(i.strip())
            num = a2[0][1:]
            title = a2[1]

            import lino
            fn = Path(lino.__file__).parent.parent.child('docs', 'tickets')
            fn = fn.child(num + '.rst')
            kw = dict()
            kw.update(created=datetime.datetime.fromtimestamp(fn.ctime()))
            kw.update(modified=datetime.datetime.fromtimestamp(fn.mtime()))
            kw.update(id=int(num), summary=title, project=prj, state=state)
            logger.info("%s %s", fn, kw['modified'])
            kw.update(description=fn.read_file())
            # fd = open(fn)
            yield Ticket(**kw)
Example #26
0
def server(hostname=None, fqdn=None, email=None):
    '''
    Setup a new server: server_setup:hostname,fqdn,email

    Example: server:stage,stage.ifmt.edu.br,[email protected]
    '''
    hostname = hostname or env.PROJECT.instance
    fqdn = fqdn or env.host_string
    email = email or 'root@' + fqdn


    puts(green('Setting up server: hostname=%(hostname)s fqdn=%(fqdn)s email=%(email)s' % locals()))

    scripts = Path(__file__).parent.child('scripts')

    files = [
        scripts.child('server_setup.sh'),
        scripts.child('postfix.sh'),
        scripts.child('watchdog.sh'),
    ]

    # Choose database
    answer = ask('Which database to install? [P]ostgres, [M]ysql, [N]one ',
        options={
            'P': [scripts.child('pg_hba.conf'), scripts.child('postgresql.sh')],
            'M': [scripts.child('mysql.sh')],
            'N': []})

    files.extend(answer)

    # Create superuser
    if 'Y' == ask('Create superuser? [Y]es or [N]o ', options=('Y', 'N')):
        createuser.run(as_root=True)

    # Upload files and fixes execution mode
    for localfile in files:
        put(localfile, '~/', mirror_local_mode=True)

    run('~root/server_setup.sh %(hostname)s %(fqdn)s %(email)s' % locals())
Example #27
0
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'Europe/Paris'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'fr'

LANGUAGES = (
    ('en', "English"),
    ('fr', "Français"),
)

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': PROJECT_PATH.child('example.db'),
    }
}

LOCALE_PATHS = (PROJECT_PATH.child('src', 'locale', 'vanilla_project'), )

# 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
Example #28
0
        not DEBUG,
        'BUNDLE_DIR_NAME':
        'sapl/static/sapl/frontend',
        'STATS_FILE':
        (BASE_DIR if not FRONTEND_CUSTOM else PROJECT_DIR.parent.child(
            'sapl-frontend')).child('webpack-stats.json'),
        'POLL_INTERVAL':
        0.1,
        'TIMEOUT':
        None,
        'IGNORE': [r'.+\.hot-update.js', r'.+\.map']
    }
}

STATIC_URL = '/static/'
STATIC_ROOT = PROJECT_DIR.child("collected_static")

STATICFILES_DIRS = (BASE_DIR.child('static'), )
if FRONTEND_CUSTOM:
    STATICFILES_DIRS = (
        PROJECT_DIR.parent.child('sapl-frontend').child('dist'), )

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

MEDIA_ROOT = PROJECT_DIR.child("media")
MEDIA_URL = '/media/'

FILE_UPLOAD_PERMISSIONS = 0o644
Example #29
0
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'htmlmin.middleware.HtmlMinifyMiddleware',
    'htmlmin.middleware.MarkRequestMiddleware',
)

ROOT_URLCONF = '{{ project_name }}.urls'

WSGI_APPLICATION = '{{ project_name }}.wsgi.application'

# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

DATABASES = {'default': parse('sqlite:///' + BASE_DIR.child('db.sqlite3'))}

# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME':
        'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME':
        'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME':
Example #30
0
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
        ],
        'debug':
        DEBUG,
    },
}, )

WSGI_APPLICATION = 'zap.wsgi.application'

DATABASES = {
    'default':
    config('DATABASE_URL',
           default='sqlite:///' + BASE_DIR.child('db.sqlite3'),
           cast=db_url)
}

AUTH_PASSWORD_VALIDATORS = (
    {
        'NAME':
        'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME':
        'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME':
        'django.contrib.auth.password_validation.CommonPasswordValidator',
Example #31
0
Generated by 'django-admin startproject' using Django 1.9.2.

For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""

import os

from unipath import Path

BASE_DIR = Path(__file__).ancestor(2)
MEDIA_ROOT = BASE_DIR.child("media")
STATIC_ROOT = BASE_DIR.child("static")


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 env variable" % var_name
        if DEBUG:
            warnings.warn(error_msg)
        else:
            raise ImproperlyConfigured(error_msg)

Example #32
0
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'tienda.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR.child('templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'tienda.wsgi.application'

# Password validation
Example #33
0
WSGI_APPLICATION = 'estofadora.wsgi.application'


# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'pt-br'

TIME_ZONE = 'America/Sao_Paulo'

USE_I18N = True

USE_L10N = True

USE_TZ = False


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = 'staticfiles'

MEDIA_ROOT = BASE_DIR.child('media')
MEDIA_URL = '/media/'

# Auth
LOGIN_URL = 'login:login'
LOGOUT_URL = 'login:logout'
LOGIN_REDIRECT_URL = 'core:home'
Example #34
0
ROOT_URLCONF = 'webloginsite.urls'

WSGI_APPLICATION = 'webloginsite.wsgi.application'

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    PROJECT_DIR.child('static'),
)

TEMPLATE_DIRS = (
    PROJECT_DIR.child('templates'),
)
Example #35
0
LANGUAGE_CODE = 'de'

LANGUAGES = (
    ('de', gettext_noop('German')),
    ('en', gettext_noop('English')),
)

SITE_ID = 1

USE_I18N = True
USE_L10N = True
USE_TZ = True
USE_THOUSAND_SEPARATOR = False

LOCALE_PATHS = (PROJECT_DIR.child('locale'), )

MEDIA_ROOT = PROJECT_DIR.child('template')
MEDIA_URL = '/media/'

STATIC_ROOT = PROJECT_DIR.child('static')
STATIC_URL = '/static/'

STATICFILES_DIRS = (PROJECT_DIR.child('assets'), )

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    #'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
Example #36
0
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'Compilador.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR.child('templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'Compilador.wsgi.application'

# Database
Example #37
0
        'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME':
        'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_ROOT = PROJECT_DIR.parent.child('staticfiles')
STATIC_URL = '/static/'

STATICFILES_DIRS = (PROJECT_DIR.child('static'), )

LOGIN_REDIRECT_URL = '/home/'
LOGIN_URL = '/login/'
Example #38
0
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'todo.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases

DATABASES = {
    'default': config(
        'DATABASE_URL', default='sqlite:///' + BASE_DIR.child('db.sqlite3'), cast=db_url
    )
}


# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
Example #39
0
            'loaders': [
                'cmj.utils.CmjLoader',
                'django.template.loaders.app_directories.Loader'
            ]
        },
    },
]

DAB_FIELD_RENDERER = \
    'django_admin_bootstrapped.renderers.BootstrapFieldRenderer'
CRISPY_TEMPLATE_PACK = 'bootstrap4'
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap4'
CRISPY_FAIL_SILENTLY = not DEBUG

STATIC_URL = '/static/'
STATIC_ROOT = PROJECT_DIR.child("collected_static")

PROJECT_DIR_FRONTEND = PROJECT_DIR.child('_frontend').child(FRONTEND_VERSION)

FRONTEND_BRASAO_PATH = {
    '32':
    PROJECT_DIR_FRONTEND.child('public').child('brasao').child(
        'brasao_32.png'),
    '64':
    PROJECT_DIR_FRONTEND.child('public').child('brasao').child(
        'brasao_64.png'),
    '128':
    PROJECT_DIR_FRONTEND.child('public').child('brasao').child(
        'brasao_128.png'),
    '256':
    PROJECT_DIR_FRONTEND.child('public').child('brasao').child(
Example #40
0
import os
import sys
from unipath import Path

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = Path(__file__).ancestor(3)
sys.path.append(BASE_DIR.child('apps'))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = ''

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'reusable.apps.ReusableConfig',
    'accounts.apps.AccountsConfig',
    'dashboard.apps.DashboardConfig',
    'levels.apps.LevelsConfig',
    'suscriptions.apps.SuscriptionsConfig',
    'corsheaders',
    'storages',
    'rest_framework',
Example #41
0
import dj_database_url

PROJECT_DIR = Path(__file__).parent


DEBUG = os.environ.get('DEBUG') == 'True'
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '*****@*****.**'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': dj_database_url.config(default='sqlite:///' + PROJECT_DIR.child('database.db'))
}

# 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/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
Example #42
0
                                  None)

from atelier.sphinxconf import interproject
interproject.configure(globals())

if False:
    from importlib import import_module
    # for n in ['atelier', 'lino', 'lino_xl']:
    for n in ['atelier']:
        m = import_module(n)
        for k, v in m.intersphinx_urls.items():
            if k == 'docs':  # backwards compat
                k = n.replace('_', "")
            if True:
                local_file = Path(m.__file__).parent.parent
                local_file = local_file.child('docs', '.build', 'objects.inv')
                if local_file.exists():
                    # local_file = "file://" + local_file
                    local_file = (local_file, v)
                else:
                    print("20160516 No such file: {}".format(local_file))
                    local_file = None
                intersphinx_mapping[k] = (v, local_file)
            else:
                intersphinx_mapping[k] = (v, None)

autosummary_generate = True

#~ nitpicky = True # use -n in Makefile instead

# http://sphinx.pocoo.org/theming.html
Example #43
0
    },
]


# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/

LANGUAGE_CODE = 'pt-br'

TIME_ZONE = 'America/Araguaina'

USE_I18N = True

USE_L10N = True

USE_TZ = True

DATE_FORMAT = '%d/%m/%Y'

TIME_FORMAT = '%H:%M:%S'

DATE_INPUT_FORMATS = ('%d/%m/%Y',)


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/

STATIC_URL = '/static/'
STATICFILES_DIRS = (BASE_DIR.child('static'),)
STATIC_ROOT = BASE_DIR.parent.child('static')
Example #44
0
LANGUAGE_CODE = 'es-PE'

TIME_ZONE = 'America/Lima'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/

STATIC_URL = '/static/'

MEDIA_URL = '/media/'

MEDIA_ROOT = BASE_DIR.child('media')

# Grappelli admin title
GRAPPELLI_ADMIN_TITLE = 'Hero Denim'

# Django rest framework
REST_FRAMEWORK = {
    # Use Django's standard `django.contrib.auth` permissions,
    # or allow read-only access for unauthenticated users.
    'DEFAULT_PERMISSION_CLASSES':
    ['rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly']
}
Example #45
0
# coding: utf-8
from decimal import Decimal
from unipath import Path
import os

PROJECT_DIR = Path(__file__).parent.parent
SECRET_KEY = '*bz++cf(*#++vpo+b+=m3%p9#*x$$&0mjs90x3oo5u@^zyvh)0'

FRESPO_PROJECT_ID = -1  # only needed for backwards compatibility with south patch 0008_set_isfeedback_true.py

MEDIA_ROOT = PROJECT_DIR.child('core').child('static').child('media')
MEDIA_ROOT_URL = '/static/media'

SITE_PROTOCOL = 'http'
SITE_HOST = 'localhost:8000'
SITE_NAME = 'FreedomSponsors'
SITE_HOME = SITE_PROTOCOL + '://' + SITE_HOST

# 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.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Sao_Paulo'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
Example #46
0
#!/usr/bin/env python3
import click
import os
import subprocess
import shlex
import random
from datetime import date
from cprint import cprint
from shutil import copyfile
from unipath import Path
from jinja2 import Environment, FileSystemLoader, select_autoescape

SKETCH_DIR = Path(__file__).parent
TEMPLATES_DIR = SKETCH_DIR.child('templates')

templates = Environment(
    loader=FileSystemLoader(TEMPLATES_DIR),
)

@click.group()
def cli():
    pass

@cli.command('new')
@click.argument('sketch_name')
def configure_new_sketch(sketch_name):
    """
    Create dir and configure boilerplate
    """
    new_dir = SKETCH_DIR.child(sketch_name)
    new_sketch = new_dir.child(f'{sketch_name}.pyde')
Example #47
0
# coding: utf-8

from authomatic.providers import oauth1, oauth2
from unipath import Path
from decouple import config

# file paths
BASEDIR = Path(__file__).parent
SITE_STATIC = BASEDIR.child('findaconf', 'blueprints', 'site', 'static')

# db settings
uri = 'sqlite:///' + BASEDIR.child('app.db')
SQLALCHEMY_DATABASE_URI = config('DATABASE_URL', default=uri)

# debug settings
DEBUG = config('DEBUG', default=False, cast=bool)
ASSETS_DEBUG = config('ASSETS_DEBUG', default=False, cast=bool)

# security keys & settings
SECRET_KEY = config('SECRET_KEY', default=False)
WTF_CSRF_ENABLED = True

# site admins
ADMIN = config('ADMIN',
               default=list(),
               cast=lambda x: [s.strip() for s in x.split(',')])

# public api keys
GOOGLE_PUBLIC_API = config('GOOGLE_PUBLIC_API', default=None)
GOOGLE_PLACES_PROXY = config('GOOGLE_PLACES_PROXY', default=None)
Example #48
0
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'app.wsgi.application'

# Database + Error Tracking

DATABASES = {}

client = None

if config('IS_TRAVIS', default=False, cast=bool):
    DATABASES['default'] = dj_database_url.parse('sqlite:///' + BASE_DIR.child('db.sqlite3'))
else:
    # EMAIL:
    EMAIL_HOST = config('EMAIL_HOST', default=os.environ.get('EMAIL_HOST'), cast=str)
    EMAIL_PORT = config('EMAIL_PORT', default=os.environ.get('EMAIL_PORT'), cast=int)
    EMAIL_HOST_USER = config('EMAIL_HOST_USER', default=os.environ.get('EMAIL_HOST_USER'), cast=str)
    EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', default=os.environ.get('EMAIL_HOST_PASSWORD'), cast=str)
    EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=os.environ.get('EMAIL_USE_TLS'), cast=bool)

    # Raven Settings:
    client = Client(config('RAVEN_DSN', default=os.environ.get('RAVEN_DSN'), cast=str))
    DATABASES['default'] = dj_database_url.parse(config('DATABASE_URL', default=os.environ.get('DATABASE_URL'), cast=str), conn_max_age=600)    

# Password validation

AUTH_PASSWORD_VALIDATORS = [
Example #49
0
import os
import requests
from cprint import cprint
from unipath import Path

from genome import VisualGenomeData

PROJECT_ROOT = Path(__file__).absolute().parent
RESULTS_DIR = PROJECT_ROOT.child('results')

visual_genome = VisualGenomeData()
visual_genome.load()

results = visual_genome.fetch_results()

good = 0
i = 0
while good < 10:
    i += 1
    cprint.info(f"Parsing result {i} / goods {good}...")
    test_data = next(results)
    response = requests.get(test_data.img_url)
    if response.ok:
        graph = test_data.get_graph()

        img_names = []
        for node in graph.nodes():
            node_data = graph.nodes[node]
            if not node_data:
                continue
Example #50
0
    "django.core.context_processors.static",
    "django.core.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    "django.core.context_processors.request",
)

ROOT_URLCONF = 'stormsecurity.urls'

WSGI_APPLICATION = 'stormsecurity.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

DATABASES = {
    'default': parse('sqlite:///' + BASE_DIR.child('db.sqlite3'))
}

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'pt-BR'

TIME_ZONE = 'America/Sao_Paulo'

USE_I18N = True

USE_L10N = True

USE_TZ = True
Example #51
0
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'ContriHub.urls'

TEMPLATES = [
    {
        'BACKEND':
        'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            BASE_DIR.child('templates'),
            BASE_DIR.child('templates', 'templates'),
        ],
        'APP_DIRS':
        True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
Example #52
0
import os
import re
import json
from unipath import Path
from distutils.util import strtobool
from django.core.exceptions import ImproperlyConfigured

# Project base path
BASE_DIR = Path(__file__).absolute().ancestor(2)

# Project root directories
MEDIA_ROOT = BASE_DIR.child('media')
LOGGING_ROOT = BASE_DIR.child('logs')
TEMPLATE_ROOT = BASE_DIR.child('templates')

# Ensure project root directories exists
MEDIA_ROOT.mkdir()
LOGGING_ROOT.mkdir()
TEMPLATE_ROOT.mkdir()

# Use OS environment variables to load sensitive or dynamic settings
settings_environment = os.environ

# Alternatively, we can use JSON file
# with open(os.path.join(BASE_DIR, "config.json")) as f:
#     settings_environment = json.loads(f.read())


# Leverage setting retrieval function to abstract the retrieval and manipulation
# of sensitive or dynamic settings so we can load from either the OS environment or
# a configuration file without making alot of changes throughout
Example #53
0
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

LANGUAGES = (('en', 'English'), ('pt-br', 'Portuguese'), ('es', 'Spanish'))

LOCALE_PATHS = (PROJECT_DIR.child('locale'), )

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

STATIC_ROOT = PROJECT_DIR.parent.child('staticfiles')
STATIC_URL = '/static/'

STATICFILES_DIRS = (PROJECT_DIR.child('static'), )

MEDIA_ROOT = PROJECT_DIR.parent.child('media')
MEDIA_URL = '/media/'

TEMPLATE_DIRS = (PROJECT_DIR.child('templates'), )

LOGIN_URL = '/'
Example #54
0
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    # Third-party middlewares
    'whitenoise.middleware.WhiteNoiseMiddleware',

    # Local middlewares
]

# URL and gateway config
ROOT_URLCONF = 'backend.urls'
SITE_ID = 1
WSGI_APPLICATION = 'backend.wsgi.application'

# Database
DATABASES = {
    'default':
    config('DATABASE_URL',
           default='sqlite:///{}'.format(BASE_DIR.child('db.sqlite3')),
           cast=db_url),
}

# Internationalization
LANGUAGE_CODE = config('LANGUAGE_CODE', default='en-us')
TIME_ZONE = config('TIME_ZONE', default='America/Fortaleza')
USE_I18N = True
USE_L10N = True
USE_TZ = True
Example #55
0
from unipath import Path
PROJECT_DIR = Path(__file__).parent

DEBUG = os.environ.get('DEBUG') == 'True'
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '*****@*****.**'),
)

MANAGERS = ADMINS

DATABASES = {
    'default':
    dj_database_url.config(default='sqlite:///' +
                           PROJECT_DIR.child('database.db'))
}

# 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 = ['.localhost', '127.0.0.1', '.herokuapp.com']

# 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/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
Example #56
0
TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

LANGUAGES = (
    ('en', 'English'),
    ('pt-br', 'Portuguese'),
    ('es', 'Spanish')
)

LOCALE_PATHS = (PROJECT_DIR.child('locale'), )

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

STATIC_ROOT = PROJECT_DIR.parent.child('staticfiles')
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    PROJECT_DIR.child('static'),
)

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'


MEDIA_ROOT = PROJECT_DIR.parent.child('media')
Example #57
0
# DJANGO BASE SETTINGS

import os, sys
from os import environ
from os.path import basename
from unipath import Path


########## PATH CONFIGURATION
PROJECT_DIR = Path(__file__).ancestor(2)
MEDIA_ROOT = PROJECT_DIR.child("media")
STATIC_ROOT = PROJECT_DIR.child("static")
STATICFILES_DIRS = (
    PROJECT_DIR.child("styles"),
)
TEMPLATE_DIRS = (
    PROJECT_DIR.child("templates"),
)
ROOT_URLCONF = 'urls'

# Site name...
SITE_NAME = basename(PROJECT_DIR)
########## END PATH CONFIGURATION


########## EXCEPTION HANDLING
# 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_variable(var_name):
Example #58
0
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 = False

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = RUTA_PROYECTO.child('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 = ''

# 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 = ''

# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
Example #59
0
import os
import sys
import datetime
from unipath import Path


from djcelery import setup_loader

# Specific settings
CONFIRM_IN_DAYS = 14

PROJECT_ROOT = Path(__file__).ancestor(3)
sys.path.append(PROJECT_ROOT.child("apps"))

DEBUG = False
TEMPLATE_DEBUG = DEBUG

ADMINS = (("Olexandr Shalakhin", "*****@*****.**"),)

ALLOWED_HOSTS = ["douhack.herokuapp.com"]
MANAGERS = ADMINS
TIME_ZONE = "Europe/Kiev"
LOCALE_PATHS = (PROJECT_ROOT.child("locale"),)
LANGUAGE_CODE = "ru-UA"
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = True
MEDIA_ROOT = PROJECT_ROOT.child("media")
MEDIA_URL = "/m/"
STATIC_ROOT = PROJECT_ROOT.child("static_collected")
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'FinancialPredictions.urls'

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [PROJECT_DIR.child('templates'),],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'FinancialPredictions.wsgi.application'