Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clarified/simplified install documentation

  • Loading branch information...
commit f8ae940f1c3ae2294b7cc962e9ff3f80a46f787a 1 parent 7374976
@exhuma authored
Showing with 57 additions and 10 deletions.
  1. +17 −9 README.rst
  2. +2 −1  mod_wsgi/app.wsgi
  3. +38 −0 setup.py
View
26 README.rst
@@ -98,13 +98,13 @@ The installation procedure:
- Prepare the apache environment::
mkdir wsgi
- cp mypi-x.y/mod_wsgi/app.wsgi wsgi
+ cp env/usr/share/docs/mypi/examples/app.wsgi wsgi
cd wsgi
- Prepare the database::
../env/bin/migrate manage manage.py \
- --repository=../mypi-x.y/db_repo \
+ --repository=../env/usr/share/docs/mypi/db_repo \
--url=sqlite:///app.db
../env/bin/python manage.py version_control
../env/bin/python manage.py upgrade
@@ -116,9 +116,10 @@ The installation procedure:
- Configure apache::
- sudo cp /var/www/mypi/mypi-x.y/mod_wsgi/example.apache.conf
- /etc/apache2/sites-available/mypi
+ sudo cp ~mypi/env/usr/share/docs/mypi/examples/example.apache.conf \
+ /etc/apache2/sites-available/mypi
sudo ${EDITOR} /etc/apache2/sites-available/mypi
+ sudo ${EDITOR} ~mypi/wsgi/app.wsgi
sudo a2ensite mypi
sudo a2enmod wsgi
sudo apache2ctl -t && sudo /etc/init.d/apache2 restart
@@ -130,8 +131,15 @@ The installation procedure:
Development
-----------
-Note that this application currently uses a *very* naïve sqlite database. It
-could use some imprevements. The database is versioned using
-``sqlalchemy-migrate``. Be sure to read up on this before you make changes to
-the schema. For your convenience there is a quick example ``postinst.sh``
-script, which initialised the database and puts it into version-control.
+The database is versioned using ``sqlalchemy-migrate``. Be sure to read up on
+this before you make changes to the schema.
+
+.. important:: It turned out that certain schema modifications are not working
+ well with SQLite. For this reason, sqlalchemt-migrate is
+ currently not being used to it's fullest extent. It's primarily
+ used to create the database. New installations should
+ re-create the database from scratch. I know that this is far
+ from perfect. But so far I only tested with SQLite. If new
+ migrations are added which require a DB recycle, I will note
+ this in the installation docs!
+
View
3  mod_wsgi/app.wsgi
@@ -24,7 +24,8 @@ LOG = logging.getLogger(__name__)
LOG.debug('Current path: {0}'.format(getcwd()))
# The database connection string. The database should be first initialised
-# using sqlalchemy-migrate!
+# using sqlalchemy-migrate! This specific line will put the file relative to
+# this .wsgi script
rebind('sqlite:///app.db', False)
# Application config
View
38 setup.py
@@ -1,4 +1,8 @@
from setuptools import setup, find_packages
+from setuptools.command.install import install
+from os.path import join
+from sys import prefix
+import os
PACKAGE = "mypi"
NAME = "mypi"
@@ -7,6 +11,34 @@
AUTHOR_EMAIL = "michel@albert.lu"
VERSION = __import__(PACKAGE).__version__
+def get_data_files(root, prefix=None) :
+ """
+ Returns a list readily formed for the ``data_files`` parameter in
+ ``setup``.
+
+ prefix
+ prefix all target folders with this value
+ """
+ out = []
+ for path, dirs, files in os.walk('db_repo'):
+
+ if prefix:
+ tgt_path = join(prefix, path)
+ else:
+ tgt_path = path
+
+ out.append((tgt_path, [join(path, _) for _ in files]))
+ return out
+
+db_repo_files = get_data_files('db_repo', prefix=join(prefix,
+ 'usr/share/docs/mypi'))
+
+class MypiInstall(install):
+ def run(self):
+ install.run(self)
+ # TODO: ask the user for WSGI and DB settings
+ pass
+
setup(
name=NAME,
version=VERSION,
@@ -22,5 +54,11 @@
'SQLAlchemy==0.7.3'
],
packages=find_packages(exclude=["tests.*", "tests"]),
+ data_files=[
+ (join(prefix,'usr/share/docs/mypi/examples'),
+ ['mod_wsgi/app.wsgi', 'mod_wsgi/example.apache.conf']),
+ ] + db_repo_files,
+ cmdclass={'install': MypiInstall},
zip_safe=False,
)
+
Please sign in to comment.
Something went wrong with that request. Please try again.