Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tentative wsgi script and fabfile for deployment.
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from fabric.context_managers import settings, cd | ||
from fabric.api import task, env | ||
from fabric.operations import run | ||
|
||
env.proj_root = '/var/htmlpad.org' | ||
REPO_URL = "git://github.com/hackasaurus/htmlpad.git" | ||
DJANGO_REPO = "/var/repositories/django" | ||
|
||
def run_manage_cmd(cmd): | ||
with cd('%s/htmlpad_dot_org' % env.proj_root): | ||
run('python manage.py %s' % cmd) | ||
|
||
@task | ||
def clone(): | ||
run('git clone %s %s' % (REPO_URL, env.proj_root)) | ||
with cd(env.proj_root): | ||
run('git submodule init') | ||
run('git config submodule.vendor/django.url %s' % DJANGO_REPO) | ||
run('git submodule update') | ||
|
||
@task | ||
def update(): | ||
with cd(env.proj_root): | ||
run('git pull') | ||
|
||
@task | ||
def deploy(): | ||
update() | ||
run_manage_cmd('collectstatic --noinput') | ||
run_manage_cmd('test') | ||
run('touch %s/wsgi/htmlpad.wsgi' % env.proj_root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import os | ||
import site | ||
|
||
ROOT = os.path.dirname(os.path.abspath(__file__)) | ||
path = lambda *a: os.path.join(ROOT, *a) | ||
|
||
# Add the app dir to the python path so we can import manage. | ||
site.addsitedir(path('..', 'htmlpad_dot_org')) | ||
|
||
# manage adds more directories to the Python path. | ||
import manage | ||
|
||
import django.core.handlers.wsgi | ||
application = django.core.handlers.wsgi.WSGIHandler() |