Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 45 additions and 7 deletions.
  1. +11 −0 apache/staging.conf
  2. +33 −6 fabfile.py
  3. +1 −1 templates/home.djhtml
View
11 apache/staging.conf
@@ -8,6 +8,17 @@
# To be changed every year :-)
RedirectMatch ^/$ /2012/
+
+ ###
+ # Statically serving the archived old websites.
+ DocumentRoot /srv/fscons.org/archives/
+ <Directory /srv/fscons.org/archives/>
+ Options Indexes FollowSymLinks MultiViews
+ AllowOverride All
+ Order allow,deny
+ allow from all
+ </Directory>
+
####
# As indicated in the documentation for django deployment,
# this part tells apache where to find the static files
View
39 fabfile.py
@@ -3,12 +3,15 @@
from fabric.contrib import files, console
from fabric.contrib.project import rsync_project
from fabric import utils
+from fabric.api import env, require, run, sudo, cd
import os
-env.hosts = ['178.79.156.98']
+env.hosts = ['fscons.org']
env.user = 'gdetrez'
env.root = '/srv/fscons.org'
-env.virtualenv_root = '/srv/fscons.org/env'
+env.project_root = os.path.join(env.root, 'myconf')
+env.virtualenv_root = os.path.join(env.root, 'env')
+env.activate_script = os.path.join(env.virtualenv_root, 'bin','activate')
RSYNC_EXCLUDE = (
'.DS_Store',
@@ -24,22 +27,46 @@
@task(default=True)
def deploy():
- """ rsync code to remote host """
if not console.confirm('Are you sure you want to deploy production?',
default=False):
utils.abort('Production deployment aborted.')
+ rsync()
+ collectstatic()
+ reload()
+
+
+def virtualenv(command, use_sudo=False):
+ if use_sudo:
+ func = sudo
+ else:
+ func = run
+ func('source "%s" && %s' % (env.activate_script, command))
+
+def manage_py(command, use_sudo=False):
+ with cd(env.project_root):
+ virtualenv('python manage.py %s' % command, use_sudo)
+
+@task
+def collectstatic():
+ #require('hosts', provided_by=[production])
+ manage_py('collectstatic -l --noinput')
+
+@task
+def rsync():
+ """ rsync code to remote host """
extra_opts = '--omit-dir-times'
rsync_project(
env.root,
exclude=RSYNC_EXCLUDE,
delete=True,
extra_opts=extra_opts,
)
- touch()
-def touch():
+@task
+def reload():
""" touch wsgi file to trigger reload """
- #require('code_root', provided_by=('staging', 'production'))
apache_dir = os.path.join(env.root, 'myconf', 'apache')
with cd(apache_dir):
run('touch staging.wsgi')
+
+
View
2 templates/home.djhtml
@@ -9,7 +9,7 @@
<p>Welcome to FSCONS 2012!</p>
<p>We're the largest gathering for free culture, free software and a free society in the Nordic countries. The conference is organised by the <a href="http://ffkp.se/">Society for Free Culture and Software</a> in Göteborg, Sweden.</p>
<p>
- <strong>The conference takes place the 9-12th of November 2012!</strong>
+ <strong>The conference takes place the 9-11th of November 2012!</strong>
</p>
<ul id="main-navigation" class="listview">

No commit comments for this range

Something went wrong with that request. Please try again.