inital project layout
This commit is contained in:
commit
dd9fae43f4
21
README
Normal file
21
README
Normal file
|
@ -0,0 +1,21 @@
|
|||
trubox
|
||||
|
||||
Get:
|
||||
bzr branch PUBLIC_URL trubox
|
||||
cd trubox
|
||||
virtualenv .
|
||||
pip -E . install -r requirements.txt
|
||||
|
||||
Develop:
|
||||
create trubox/local_settings.py
|
||||
|
||||
. bin/activate
|
||||
cd trubox
|
||||
python manage.py shell
|
||||
|
||||
python manage.py runserver
|
||||
|
||||
Deploy:
|
||||
create trubox/local_settings.py
|
||||
|
||||
create /etc/apache2/sites-availavle/sitename.conf
|
46
fabfile.py
vendored
Normal file
46
fabfile.py
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
#this is a fabfile, use it with fab from http://fabfile.org/
|
||||
#
|
||||
# initial setup:
|
||||
# fab production setup
|
||||
#
|
||||
# deploy changes:
|
||||
# fab production deploy
|
||||
#
|
||||
|
||||
from os.path import join
|
||||
from fabric.api import run, local, sudo, put, env
|
||||
|
||||
env.project_name = 'trubox'
|
||||
|
||||
def production():
|
||||
env.hosts = ['%(project_name)s@camp.r-w-x.org'%env, ]
|
||||
env.project_root = '/srv/(project_name)]s'%env
|
||||
|
||||
def bzr_push():
|
||||
local('bzr push bzr+ssh://%(host)s%(project_root)s'%env)
|
||||
|
||||
def bzr_update():
|
||||
run('cd %(project_root)s;bzr update'%env)
|
||||
|
||||
def virtual_run(cmd, *a, **kw):
|
||||
cmd = 'cd %s; source bin/activate; %s' % (env.project_root, cmd)
|
||||
run(cmd, *a, **kw)
|
||||
|
||||
def update_requirements():
|
||||
run('pip -E %(project_root)s install -r %(project_root)s/requirements.txt'%env)
|
||||
|
||||
def setup():
|
||||
"""
|
||||
Setup a fresh virtualenv
|
||||
"""
|
||||
local('bzr push --use-existing-dir bzr+ssh://%(host)s%(project_root)s'%env)
|
||||
run('cd %(project_root)s; test -e .bzr/checkout || bzr checkout'%env)
|
||||
run('virtualenv %(project_root)s'%env)
|
||||
put(join('settings', '%(host)s.py'%env), join(env.project_root, env.project_name, 'local_settings.py'))
|
||||
update_requirements()
|
||||
|
||||
def deploy():
|
||||
bzr_push()
|
||||
bzr_update()
|
||||
virtual_run('python %(project_name)s/manage.py syncdb;python %(project_name)s/manage.py migrate'%env)
|
||||
run('touch %(project_root)s/wsgi/django.wsgi'%env)
|
4
requirements.txt
Normal file
4
requirements.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
-e svn+http://code.djangoproject.com/svn/django/branches/releases/1.3.X/#egg=django
|
||||
-e bzr+http://code.0xdb.org/python-ox/#egg=python-ox
|
||||
django_extensions
|
||||
South
|
27
wsgi/django.wsgi
Normal file
27
wsgi/django.wsgi
Normal file
|
@ -0,0 +1,27 @@
|
|||
# django.wsgi for trubox
|
||||
import os
|
||||
import sys
|
||||
import site
|
||||
|
||||
project_module = 'trubox'
|
||||
|
||||
root_dir = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
|
||||
#using virtualenv's activate_this.py to reorder sys.path
|
||||
activate_this = os.path.join(root_dir, 'bin', 'activate_this.py')
|
||||
execfile(activate_this, dict(__file__=activate_this))
|
||||
|
||||
sys.path.append(root_dir)
|
||||
sys.path.append(os.path.join(root_dir, project_module))
|
||||
|
||||
#reload if this django.wsgi gets touched
|
||||
from ox.django import monitor
|
||||
monitor.start(interval=1.0)
|
||||
|
||||
monitor.track(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = project_module + '.settings'
|
||||
|
||||
import django.core.handlers.wsgi
|
||||
|
||||
application = django.core.handlers.wsgi.WSGIHandler()
|
Loading…
Reference in New Issue
Block a user