fnp
/
fnpdjango.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
deploy: set secret_key on setup
[fnpdjango.git]
/
fnpdjango
/
deploy
/
__init__.py
diff --git
a/fnpdjango/deploy/__init__.py
b/fnpdjango/deploy/__init__.py
index
e5cf30b
..
fb093f8
100644
(file)
--- a/
fnpdjango/deploy/__init__.py
+++ b/
fnpdjango/deploy/__init__.py
@@
-12,8
+12,9
@@
Then set up some env properties:
services: list of tasks to run after deployment
"""
services: list of tasks to run after deployment
"""
-from fabric.api import *
from os.path import abspath, dirname, exists, join
from os.path import abspath, dirname, exists, join
+from django.utils.crypto import get_random_string
+from fabric.api import *
from fabric.contrib import files
from fabric.tasks import Task, execute
from fabric.contrib import files
from fabric.tasks import Task, execute
@@
-31,7
+32,7
@@
def setup():
run('mkdir -p %(app_path)s' % env, pty=True)
run('%(virtualenv)s %(app_path)s/ve' % env, pty=True)
run('mkdir -p %(app_path)s' % env, pty=True)
run('%(virtualenv)s %(app_path)s/ve' % env, pty=True)
- run('mkdir -p %(app_path)s/releases %(app_path)s/packages' % env, pty=True)
+ run('mkdir -p %(app_path)s/releases %(app_path)s/packages
%(app_path)s/log
' % env, pty=True)
run('cd %(app_path)s/releases; ln -sfT . current; ln -sfT . previous' % env, pty=True)
upload_samples()
print "Fill out db details in localsettings.py and run deploy."
run('cd %(app_path)s/releases; ln -sfT . current; ln -sfT . previous' % env, pty=True)
upload_samples()
print "Fill out db details in localsettings.py and run deploy."
@@
-144,7
+145,7
@@
def upload_localsettings_sample():
template = '%(project_name)s/localsettings.py.template'
if not exists(template):
template = join(dirname(abspath(__file__)), 'templates/localsettings.py.template')
template = '%(project_name)s/localsettings.py.template'
if not exists(template):
template = join(dirname(abspath(__file__)), 'templates/localsettings.py.template')
- env.secret_key =
'' # sth random
+ env.secret_key =
get_random_string(50)
files.upload_template(template, '%(app_path)s/localsettings.py.sample' % env, env)
def upload_nginx_sample():
files.upload_template(template, '%(app_path)s/localsettings.py.sample' % env, env)
def upload_nginx_sample():
@@
-199,7
+200,7
@@
def symlink_current_release():
print '>>> symlink current release'
require('release', provided_by=[deploy])
require('app_path')
print '>>> symlink current release'
require('release', provided_by=[deploy])
require('app_path')
- with cd(env.path):
+ with cd(env.
app_
path):
run('rm releases/previous; mv releases/current releases/previous')
run('ln -s %(release)s releases/current' % env)
run('rm releases/previous; mv releases/current releases/previous')
run('ln -s %(release)s releases/current' % env)