node_modules
/static_test
-chromedriver.log
\ No newline at end of file
+chromedriver.log
+
+deployment/environments.py
+apps/wiki/static/wiki/build
--- /dev/null
+import os
+from subprocess import call
+from optparse import make_option
+
+from django.core.management.base import BaseCommand, CommandError
+from django.core.management import call_command
+
+
+class Command(BaseCommand):
+
+ option_list = BaseCommand.option_list + (
+ make_option('--node-bin-path',
+ action='store',
+ dest='node_bin_path',
+ type='string',
+ default=None,
+ help='Path to node binary'),
+ make_option('--npm-bin',
+ action='store',
+ dest='npm_bin',
+ type='string',
+ default='npm',
+ help='Path to npm binary'),
+ )
+
+ def handle(self, **options):
+ wiki_base_dir = os.path.join(os.getcwd(), 'apps', 'wiki', 'static', 'wiki')
+ rng_base_dir = os.path.join(wiki_base_dir, 'rng')
+ build_dir = os.path.join(wiki_base_dir, 'build')
+
+ self.stdout.write('Installing editor dependencies')
+ try:
+ call([options['npm_bin'], 'install'], cwd = rng_base_dir)
+ except OSError:
+ raise CommandError('Something went wrong, propably npm binary not found. Tried: %s' % options['npm_bin'])
+
+ self.stdout.write('Building editor')
+ if options['node_bin_path']:
+ # grunt needs npm binary to be foundable in PATH
+ os.environ['PATH'] = '%s:%s' % (options['node_bin_path'], os.environ['PATH'])
+ call(['./node_modules/.bin/grunt', 'build', '--output-dir=%s' % build_dir], cwd = rng_base_dir)
+
+ call_command('collectstatic', interactive = False, ignore_patterns = ['rng'])
--- /dev/null
+from fabric.api import env
+from fabric.tasks import Task
+from fnpdjango.deploy import Command
+
+
+class Environment(Task):
+ def __init__(self, *args, **kwargs):
+ super(Environment, self).__init__(*args, **kwargs)
+ self.npm_bin = kwargs.pop('npm_bin', 'npm')
+ self.host = kwargs.pop('host')
+ self.env_vars = kwargs
+ self.env_vars['skip_collect_static'] = True
+
+ def run(self, *args, **kwargs):
+ env.project_name = 'redakcja'
+ env.hosts = [self.host]
+ for k,v in self.env_vars.items():
+ env[k] = v
+
+ build_cmd = '../../ve/bin/python manage.py build --npm-bin=%s' % self.npm_bin
+ if 'node_bin_path' in self.env_vars:
+ build_cmd += ' --node-bin-path=%s' % self.env_vars['node_bin_path']
+
+ env.pre_collectstatic = [
+ Command([build_cmd], '')
+ ]
--- /dev/null
+from fnpdjango.deploy import DebianGunicorn
+from base import Environment
+
+
+env1 = Environment(
+ host = '',
+ user = '',
+ app_path = '',
+ services = [
+ DebianGunicorn('')
+ ],
+ node_bin_path = '/usr/bin',
+ npm_bin = 'npm',
+)
\ No newline at end of file
--- /dev/null
+from fnpdjango.deploy import *
+from deployment.environments import *
'toolbar',
'apiclient',
'email_mangler',
+ 'build'
)
LOGIN_REDIRECT_URL = '/documents/user'
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+
+if getattr(settings, 'SERVE_FILES_WITH_DEBUG_FALSE', False):
+ urlpatterns += patterns('',
+ (r'^%s(?P<path>.*)$' % settings.STATIC_URL[1:], 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
+ (r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
+)
--- /dev/null
+-i http://pypi.nowoczesnapolska.org.pl/simple
+
+fabric
+fnpdjango>=0.1.10,<0.2