示例#1
0
    def do(self):
        '''
        payout the delegate reward after saving the payouts for a certain time
        '''

        try:
            delegate = ark_delegate_manager.models.DutchDelegateStatus.objects.get(
                id='main')
            reward = delegate.reward
            res = send_tx(conf('REWARDWALLET'), reward)
            if not res:
                logger.critical(
                    'failed to send rewardpayment to rewardswallet')
            else:
                delegate.reward = 0
                delegate.save()
        except Exception:
            logger.exception(
                'failed to transmit the delegate reward: {}'.format(reward /
                                                                    ARK))
def setup():
    # create new app
    sudo("dokku apps:create {0}".format(app_name))

    # allowed hosts
    sudo("dokku config:set {app} ALLOWED_HOSTS={app}.{server}".format(
        app=app_name, server=conf("DOKKU_SERVER")))

    # production env
    sudo("dokku config:set {app} DJANGO_SETTINGS_MODULE=config.prod".format(
        app=app_name))

    # Set SECRET
    pw = local("pwgen -s 64 -n 1", capture=True)
    sudo("dokku config:set {app} SECRET_KEY='{pw}'".format(app=app_name,
                                                           pw=pw))

    setup_db()
    setup_media()
    setup_static()
示例#3
0
from __future__ import with_statement
from alembic import context
from sqlalchemy import create_engine, pool
from logging.config import fileConfig
from decouple import config as conf

config = context.config
fileConfig(config.config_file_name)
target_metadata = None
url = conf('DATABASE_URL', default='sqlite:///:memory:')


def run_migrations_offline():
    """Run migrations in 'offline' mode.

    This configures the context with just a URL
    and not an Engine, though an Engine is acceptable
    here as well.  By skipping the Engine creation
    we don't even need a DBAPI to be available.

    Calls to context.execute() here emit the given string to the
    script output.
    """
    context.configure(url=url,
                      target_metadata=target_metadata,
                      literal_binds=True)

    with context.begin_transaction():
        context.run_migrations()

import os
from os.path import abspath, dirname, join

import dj_database_url
from decouple import config as conf


def root(*dirs):
    base_dir = join(dirname(__file__), "..")
    return abspath(join(base_dir, *dirs))


SECRET_KEY = conf('SECRET_KEY')

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = root()
PROJECT_ROOT = root('config')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
    'core',

    # wagtail cms
    'wagtail.contrib.forms',
    'wagtail.contrib.redirects',
示例#5
0
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
from flask_mail import Mail
from urllib.request import Request, urlopen, URLError
from urllib.parse import urlparse
from flask_oauth import OAuth
from decouple import config as conf

app = Flask(__name__)
app.config['SECRET_KEY'] = conf('SECRET_KEY')
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.db'
db = SQLAlchemy(app)
bcrypt = Bcrypt(app)
login_manager = LoginManager(app)
login_manager.login_view = 'login'
login_manager.login_message_category = 'info'
app.config['MAIL_SERVER'] = 'smtp.googlemail.com'
app.config['MAIL_PORT'] = 587
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USERNAME'] = conf('MAIL_USERNAME')
app.config['MAIL_PASSWORD'] = conf('MAIL_PASSWORD')
mail = Mail(app)

GOOGLE_CLIENT_ID = conf('GOOGLE_CLIENT_ID')
GOOGLE_CLIENT_SECRET = conf('GOOGLE_CLIENT_SECRET')
REDIRECT_URI = '/oauth2callback'  # one of the Redirect URIs from Google APIs console
oauth = OAuth()
from fabric.contrib.files import sed
from fabric.api import (
    env,
    local,
    sudo,
)
from decouple import config as conf

# Global env variables
env.user = conf("DOKKU_USER")
env.hosts = [conf("DOKKU_SERVER")]

app_name = conf("DOKKU_APP")


def setup_static():
    sudo("mkdir -p /home/dokku/{app}/storage/public".format(app=app_name))
    sudo("chown -R dokku:dokku /home/dokku/{app}/storage".format(app=app_name))
    sudo(
        "dokku storage:mount {app} /home/dokku/{app}/storage/public:/app/public"
        .format(app=app_name))


def setup_media():
    sudo("mkdir -p /home/dokku/{app}/storage/media".format(app=app_name))
    sudo("chown -R dokku:dokku /home/dokku/{app}/storage".format(app=app_name))
    sudo(
        "dokku storage:mount {app} /home/dokku/{app}/storage/media:/app/media".
        format(app=app_name))