Read Fabric user/host settings from Django settings
This commit is contained in:
parent
3f7a24769d
commit
6c0dbe6ba5
2 changed files with 12 additions and 4 deletions
|
|
@ -103,6 +103,9 @@ STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesSto
|
|||
|
||||
ALLOWED_HOSTS = ['localhost', 'stages.pierre-coullery.ch']
|
||||
|
||||
FABRIC_HOST = 'stages.pierre-coullery.ch'
|
||||
FABRIC_USERNAME = ''
|
||||
|
||||
# Mapping between column names of a tabular file and Student field names
|
||||
STUDENT_IMPORT_MAPPING = {
|
||||
'NOCLOEE': 'ext_id',
|
||||
|
|
|
|||
13
scripts/fabfile.py
vendored
13
scripts/fabfile.py
vendored
|
|
@ -3,21 +3,26 @@ import os
|
|||
import sys
|
||||
|
||||
from fabric.api import cd, env, get, local, prefix, prompt, run
|
||||
from fabric.contrib import django
|
||||
from fabric.utils import abort
|
||||
|
||||
env.hosts = ['stages.pierre-coullery.ch']
|
||||
APP_DIR = '/var/www/epcstages'
|
||||
VIRTUALENV_DIR = '/var/virtualenvs/stages/bin/activate'
|
||||
|
||||
"""Read settings from Django settings"""
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
django.settings_module('common.settings')
|
||||
from common import settings
|
||||
|
||||
env.hosts = [settings.FABRIC_HOST]
|
||||
env.user = settings.FABRIC_USERNAME
|
||||
|
||||
|
||||
def clone_remote_db(dbtype='sqlite'):
|
||||
"""
|
||||
Copy remote data (JSON dump), download it locally and recreate a local
|
||||
SQLite database with those data.
|
||||
"""
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from common import settings
|
||||
|
||||
db_path = settings.DATABASES['default']['NAME']
|
||||
if os.path.exists(db_path):
|
||||
rep = prompt('A local database (%s) already exists. Overwrite? (y/n)' % db_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue