second pass on packaging; works better but offline mode is still in the way
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 26 Nov 2013 15:23:32 +0000 (16:23 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 26 Nov 2013 15:23:32 +0000 (16:23 +0100)
Makefile
apache/myslice.conf
myslice/settings.py
myslice/urls.py
myslice/wsgi.py
setup.py

index 755ef95..9d850a7 100644 (file)
--- 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:
index b36a75e..c994af3 100644 (file)
@@ -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
 <VirtualHost *:80>
-        WSGIScriptAlias / /usr/share/unfold/myslice/wsgi.py
+        WSGIScriptAlias / /usr/lib/python2.7/dist-packages/myslice/wsgi.py
         <Directory /usr/share/unfold/myslice>
         <Files wsgi.py>
         Order deny,allow
@@ -21,7 +23,7 @@
 # this to be optional on that port
 
 <VirtualHost *:443>
-        WSGIScriptAlias / /usr/share/unfold/myslice/wsgi.py
+        WSGIScriptAlias / /usr/lib/python2.7/dist-packages/myslice/wsgi.py
         <Directory /usr/share/unfold/apache>
         <Files myslice.wsgi>
         Order deny,allow
index 4878c0d..9158441 100644 (file)
@@ -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',
index 3210957..8ff01f9 100644 (file)
@@ -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')),
 
 )
index 5bd9728..2fa8416 100644 (file)
@@ -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
index b9b1a75..99b077d 100644 (file)
--- 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/*')),