def deploy(): if exists(PROJ_ROOT): update() else: clone() settings = StringIO(LOCAL_SETTINGS % load_secrets(env['host'])) put(settings, '%s/settings_local.py' % PROJ_ROOT) run_manage_cmd('test') run('touch %s/wsgi/hackpub.wsgi' % PROJ_ROOT)
https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os from this_env import this_env this_env() THIS_ENVIRONMENT = os.environ['THIS_ENV'] # "PROD" / "TEST" / "DEV" if THIS_ENVIRONMENT == "PROD": from secrets import load_secrets if THIS_ENVIRONMENT == "DEV": from secrets_dev import load_secrets if THIS_ENVIRONMENT == "TEST": from secrets_test import load_secrets load_secrets() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 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 = os.environ['KARTOTEKET_SECRET_KEY'] # SECURITY WARNING: don't run with debug turned on in production! if THIS_ENVIRONMENT == "PROD": DEBUG = False if THIS_ENVIRONMENT == "DEV": DEBUG = True if THIS_ENVIRONMENT == "TEST":
for song in new_spotify_uris: print(song) #################################################################################### script_path = os.path.dirname(os.path.realpath(__file__)) from secrets import load_secrets crawler_delay = 5 # seconds queue_visited_path = "%s/data_visited_links.json" % script_path music_tags_raw_path = "%s/data_raw_tags.json" % script_path target_domain = "freakonomics.com" archive_page = "/archive/" # the index page for podcasts #Load json with previously crawled links, go to archive page, crawl it, and crawl all new links not seen before and save lines containing songs.. load_crawl_store(target_domain, archive_page, crawler_delay, queue_visited_path, music_tags_raw_path) #Load all raw song information ever found and parse it for album, artist and song name parsed_songs = parse_raw_tags(music_tags_raw_path) spotify_results_limit = 3 delay_spotify = 0.1 load_secrets() # It will put the secrets as environment variables spotify_clientid = os.environ['spotify_clientid'] spotify_secret = os.environ['spotify_secret'] located_songs_path = "%s/data_located_songs.json" % script_path # look up all parsed songs (song name, album, artist) and print out new unique spotify-URIs spotify_engine(parsed_songs, spotify_clientid, spotify_secret, located_songs_path, spotify_results_limit, delay_spotify)
from typing import List # noqa: F401 from libqtile import bar, extension, hook, layout, widget from libqtile.command import lazy from libqtile.config import Group, Key, Screen import yaml import bar import group import kbdmouse import rule import secrets import settings sec = secrets.load_secrets() s = settings.load_settings() keys = kbdmouse.bind_keys(s) mouse = kbdmouse.bind_mouse_buttons(s) groups = group.build_groups(s) group.bind_group_keys(s, keys) bar = bar.build_bar(s, sec) theme = s["theme"] layouts = [ layout.MonadTall(**theme["layout"]), layout.Max(**theme["layout"]), ] screens = [Screen(top=bar[0], bottom=bar[1])]
def try_mysql_login(username, secret_name, db): pw = load_secrets(env['host'])[secret_name] cmd = 'mysql -u %s -p%s -D %s -e "show tables;"' % (username, pw, db) with hide('running', 'stdout'): run(cmd)