Skip to content

Commit 8d35c16

Browse files
committed
Added tentative wsgi script and fabfile for deployment.
1 parent 3b7bb4f commit 8d35c16

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

fabfile.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from fabric.context_managers import settings, cd
2+
from fabric.api import task, env
3+
from fabric.operations import run
4+
5+
env.proj_root = '/var/htmlpad.org'
6+
REPO_URL = "git://github.com/hackasaurus/htmlpad.git"
7+
DJANGO_REPO = "/var/repositories/django"
8+
9+
def run_manage_cmd(cmd):
10+
with cd('%s/htmlpad_dot_org' % env.proj_root):
11+
run('python manage.py %s' % cmd)
12+
13+
@task
14+
def clone():
15+
run('git clone %s %s' % (REPO_URL, env.proj_root))
16+
with cd(env.proj_root):
17+
run('git submodule init')
18+
run('git config submodule.vendor/django.url %s' % DJANGO_REPO)
19+
run('git submodule update')
20+
21+
@task
22+
def update():
23+
with cd(env.proj_root):
24+
run('git pull')
25+
26+
@task
27+
def deploy():
28+
update()
29+
run_manage_cmd('collectstatic --noinput')
30+
run_manage_cmd('test')
31+
run('touch %s/wsgi/htmlpad.wsgi' % env.proj_root)

wsgi/htmlpad.wsgi

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
import site
3+
4+
ROOT = os.path.dirname(os.path.abspath(__file__))
5+
path = lambda *a: os.path.join(ROOT, *a)
6+
7+
# Add the app dir to the python path so we can import manage.
8+
site.addsitedir(path('..', 'htmlpad_dot_org'))
9+
10+
# manage adds more directories to the Python path.
11+
import manage
12+
13+
import django.core.handlers.wsgi
14+
application = django.core.handlers.wsgi.WSGIHandler()

0 commit comments

Comments
 (0)