Simple sample application to show the use of Parenchym.
It also shows how an AngularJS application can be integrated into the Mako templates of the Python application, based on Google's Angular Material Start (slightly changed and corrected).
We setup a complete environment to develop JavaScript code
comfortably: compile SASS, concat and minify JavaScript, reload the browser etc
with gulp
.
Being a simple sample, we hard-wire the resource tree. If you want to use the
prepared resource tree from Parenchym in the database (as you must if you want
authentication, ACLs etc.), use Parenchym's root factory instead. See comments
in greatformsoffire/__init__.py
and greatformsoffire/res/models.py
for
details.
Create one and activate it:
pyvenv greatformsoffire-py3.4-venv
source greatformsoffire-py3.4-venv/bin/activate
# or: workon greatformsoffire-py3.4-venv
pip install -U pip
Clone this repository and install it in development mode:
git clone https://github.com/dmdm/GreatFormsOfFire
cd GreatFormsOfFire
pip install -e .
For the remaining installation steps, make sure you are in the project
directory GreatFormsOfFire
!
Configure bin/setup_dirs
to your needs and run it (maybe use sudo
).
We use PostgreSQL by default. Change these steps to match your server.
-
Run SQL script
install/db/create_database.sql
to create an user account and the database itself. -
Create a subdirectory for the configuration of your host in
etc/
, e.g. by duplicatingetc/Morrigan
and create a filercsecrets.yaml
in the appropriate directory for your environment. Seeetc/Morrigan/development/rcsecrets.yaml-sample
for an example. Adjust the SQLAlchemy URL. -
Run
pym-init-db -c development.ini
Run the development server with
$VENV/bin/pserve development.ini
It listens to 0.0.0.0:6543 which you directly can access in your browser at
http://localhost:6543
.
If you want to use file watchers to automatically compile SASS etc. and reload the browser, in another console run
gulp serve
Run the production server with
$VENV/bin/pserve production.ini
It listens to 127.0.0.1:7100 which you directly can access in your browser at
http://localhost:6543
.
You may want to build the distribution version of the client app (e.g. concatenated and minified JavaScript etc) with
gulp serve:dist
In case you want for production a different web server than Waitress, e.g.
gunicorn, look at etc/Morrigan
for sample configuration.
1/
Add static files, like images etc to client/src/assets/img
, and not to
greatformsoffire/static
. The latter is a symlink that points to the former
and changes for production/development.
2/
You may use this simple sample as a starter for your own project. Perform global search and replace on "GreatFormsOfFire", "greatformsoffire" and "gfof".
Setup testing environment, behave, karma etc.