From 92db172eb967bdfec2f949a1a15592c0409a31ed Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 26 Nov 2013 16:23:32 +0100 Subject: [PATCH] second pass on packaging; works better but offline mode is still in the way --- Makefile | 4 ++-- apache/myslice.conf | 6 ++++-- myslice/settings.py | 19 +++++++++++++------ myslice/urls.py | 2 +- myslice/wsgi.py | 4 ---- setup.py | 1 + 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 755ef957..9d850a76 100644 --- a/Makefile +++ b/Makefile @@ -127,7 +127,7 @@ RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES) #################### minimal convenience for pushing work-in-progress in an apache-based depl. # xxx until we come up with a packaging this is going to be a wild guess # on debian04 I have stuff in /usr/share/myslice and a symlink in /root/myslice -INSTALLED_MAIN =/usr/share/unfold +INSTALLED_MAIN =/usr/share/pyshared # this is for a debian box INSTALLED_APACHE =/etc/apache2/sites-available/ @@ -149,7 +149,7 @@ ifeq (,$(MYSLICEBOX)) @exit 1 else +$(RSYNC) ./apache/myslice.conf $(SSHURL)/$(INSTALLED_APACHE)/ - +$(RSYNC) ./apache/init-ssl.sh ./apache/init-ssl.py $(SSHURL)/$(bindir)/ + +$(RSYNC) ./apache/unfold-init-ssl.py $(SSHURL)/$(bindir)/ endif restart: diff --git a/apache/myslice.conf b/apache/myslice.conf index b36a75ec..c994af36 100644 --- a/apache/myslice.conf +++ b/apache/myslice.conf @@ -1,5 +1,7 @@ +# xxx it might be smarter to install wsgi.py in some other location +# so we don't have to hard-wire these paths here - WSGIScriptAlias / /usr/share/unfold/myslice/wsgi.py + WSGIScriptAlias / /usr/lib/python2.7/dist-packages/myslice/wsgi.py Order deny,allow @@ -21,7 +23,7 @@ # this to be optional on that port - WSGIScriptAlias / /usr/share/unfold/myslice/wsgi.py + WSGIScriptAlias / /usr/lib/python2.7/dist-packages/myslice/wsgi.py Order deny,allow diff --git a/myslice/settings.py b/myslice/settings.py index 4878c0de..91584419 100644 --- a/myslice/settings.py +++ b/myslice/settings.py @@ -19,8 +19,15 @@ except: import traceback traceback.print_exc() -if not ROOT: - raise Exception,"Cannot find ROOT for myslice" +if os.path.isdir(os.path.join(ROOT,"static")): + DATAROOT=ROOT +else: + DATAROOT="/usr/share/unfold" + if not os.path.isdir(os.path.join(DATAROOT,"static")): + DATAROOT=None + +if not ROOT: raise Exception,"Cannot find ROOT for myslice" +if not DATAROOT: raise Exception,"Cannot find DATAROOT for myslice" #################### ADMINS = ( @@ -40,7 +47,7 @@ EMAIL_USE_TLS = False DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': os.path.join(ROOT,'myslice.sqlite3'), # Or path to database file if using sqlite3. + 'NAME': os.path.join(DATAROOT,'myslice.sqlite3'), # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. @@ -84,7 +91,7 @@ MEDIA_URL = '' # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/home/media/media.lawrence.com/static/" -STATIC_ROOT = os.path.join(ROOT,'static') +STATIC_ROOT = os.path.join(DATAROOT,'static') # URL prefix for static files. # Example: "http://media.lawrence.com/static/" @@ -154,7 +161,7 @@ TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. - os.path.join(ROOT,"templates"), + os.path.join(DATAROOT,"templates"), ) INSTALLED_APPS = ( @@ -183,7 +190,7 @@ INSTALLED_APPS = ( # 'django.contrib.admindocs', 'portal', # temporary - not packaged - 'trash', + # 'trash', 'sample', # DEPRECATED # 'django.contrib.formtools', # DEPRECATED ## 'crispy_forms', diff --git a/myslice/urls.py b/myslice/urls.py index 32109579..8ff01f93 100644 --- a/myslice/urls.py +++ b/myslice/urls.py @@ -63,6 +63,6 @@ urlpatterns = patterns( # # various trash views - bound to go away # - url(r'^trash/', include('trash.urls')), +# url(r'^trash/', include('trash.urls')), ) diff --git a/myslice/wsgi.py b/myslice/wsgi.py index 5bd97286..2fa84161 100644 --- a/myslice/wsgi.py +++ b/myslice/wsgi.py @@ -1,10 +1,6 @@ import os import sys -path = '/usr/share/unfold' -if path not in sys.path: - sys.path.append(path) - os.environ['DJANGO_SETTINGS_MODULE'] = 'myslice.settings' import django.core.handlers.wsgi diff --git a/setup.py b/setup.py index b9b1a751..99b077d7 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ from distutils.core import setup packages= [ os.path.dirname(init) for init in (glob("*/__init__.py")+glob("*/*/__init__.py")) ] setup(packages = packages, + # xxx somehow this does not seem to show up in debian packaging scripts = [ 'apache/unfold-init-ssl.sh' ], data_files = [ ( '/usr/share/unfold/static/js', glob ('static/js/*')), -- 2.43.0