From f1e6f920e97685377e877e93c76e2f2c2fd83b26 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rekucki?= Date: Tue, 8 Jun 2010 13:20:26 +0200 Subject: [PATCH 1/1] Fixed some deploy templates and settings. --- deployment.py | 11 ++++++++++- redakcja.vhost.template | 7 +++---- redakcja.wsgi.template | 8 ++++---- redakcja/settings/__init__.py | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/deployment.py b/deployment.py index 789d3425..b989fc7a 100644 --- a/deployment.py +++ b/deployment.py @@ -67,6 +67,9 @@ class DeploySite(object): def update_app(self): pass + def update_config(self): + pass + def install_dependencies(self): pass @@ -98,6 +101,8 @@ class WSGISite(DeploySite): self.env['WSGI_FILE'] = os.path.join(self.env['ROOT'], 'www', 'wsgi', self.env['PROJECT_NAME']) + '.wsgi' + self.env['WSGI_DIR'] = os.path.dirname(self.env['WSGI_FILE']) + if 'WSGI_SOURCE_FILE' not in self.env: self.env['WSGI_SOURCE_FILE'] = 'wsgi_app.template' @@ -109,6 +114,8 @@ class WSGISite(DeploySite): os.system("touch %s" % self.env['WSGI_FILE']) def update_config(self): + super(WSGISite, self).update_config() + source = self.find_resource(self.env['WSGI_SOURCE_FILE']) self.render_template(source, self.env['WSGI_FILE']) @@ -142,5 +149,7 @@ class ApacheSite(DeploySite): self.env['VHOST_FILE'] = os.path.join(self.env['CONFIG_DIR'], self.env['PROJECT_NAME'] + '.vhost') def update_config(self): + super(ApacheSite, self).update_config() + source = self.find_resource(self.env['VHOST_SOURCE_FILE']) - self.render_template(source, self.env['VHOST_CONFIG_FILE']) + self.render_template(source, self.env['VHOST_FILE']) diff --git a/redakcja.vhost.template b/redakcja.vhost.template index 1d24c675..0c56cbd1 100644 --- a/redakcja.vhost.template +++ b/redakcja.vhost.template @@ -1,19 +1,18 @@ ServerName $DOMAIN - ServerAlias $DOMAIN_ALIASES ServerAdmin $ADMIN_EMAIL WSGIDaemonProcess $PROJECT_NAME user=$WSGI_USER group=$WSGI_USER processes=$WSGI_PROCESSES threads=$WSGI_THREADS display-name=%{GROUP} WSGIProcessGroup $PROJECT_NAME - WSGIScriptAlias / $WSGI_TARGET + WSGIScriptAlias / $WSGI_FILE Order allow,deny allow from all - Alias /media $MEDIA_ROOT - + Alias /media $MEDIA_DIR + Order allow,deny Allow from all diff --git a/redakcja.wsgi.template b/redakcja.wsgi.template index 6b772f34..d271fa16 100644 --- a/redakcja.wsgi.template +++ b/redakcja.wsgi.template @@ -1,4 +1,4 @@ -#!$PYTHON +#!$PYTHON_BIN import site site.addsitedir('$PYTHON_SITE') @@ -12,9 +12,9 @@ sys.stdout = sys.stderr # Add apps and lib directories to PYTHONPATH sys.path = [ - '$PROJECT_ROOT', - '$PROJECT_ROOT/lib', - '$PROJECT_ROOT/apps', + '$APP_DIR', + '$APP_DIR/lib', + '$APP_DIR/apps', ] + sys.path # Run Django diff --git a/redakcja/settings/__init__.py b/redakcja/settings/__init__.py index 8be901ad..d3f9d7c5 100644 --- a/redakcja/settings/__init__.py +++ b/redakcja/settings/__init__.py @@ -1,5 +1,5 @@ from __future__ import absolute_import -from settings.common import * +from .common import * DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = PROJECT_ROOT + '/dev.sqlite' # Or path to database file if using sqlite3. -- 2.20.1