- Python 2.7
- PIP
- Node >= 0.10.0
- Ruby 2.0
- PostgreSQL
- cd docs
- make clean
- make html
- Docs files now available here: docs/_build/html
It is recommended that you create a virtual environment for Python. For more information see the documentation on virtualenv and virtualenvwrapper.
$ pip install -r requirements.txt
If you are not installing in a virtual environment, you may require root
privileges, so you'll need to sudo
the above command.
$ npm install
$ npm install -g gulp bower
$ bower install
$ sudo gem install sass compass
If you don't want to install gulp
or bower
globally (with the -g
flag),
you can run them from the copies installed in node_modules
by running
$ ./node_modules/.bin/gulp
$ ./node_modules/.bin/bower
$ createuser --no-createdb --no-createrole --no-superuser --password djangoapp
Password:
$ createdb --owner djangoapp polio
$ python manage.py syncdb
$ python manage.py migrate
The password for the djangoapp user can be found in settings.py
.
$ npm run build
This will compile the SASS, pack the JavaScript, and place both in the static/
directory along with all the fonts. If you have gulp
in your PATH
, you can
also run:
$ gulp build
$ npm run dist
This will build the frontend, collect all of Django's static files, and then
create zip files for the frontend and backend in the dist/
directory:
- uf04-backend.zip
- uf04-frontend.zip
Each contains the source necessary to deploy the backend and frontend, respectively. These can be copied to whatever server is hosting each of those components.
The JavaScript and CSS in the frontend zip file is minimized.
If you have gulp
in your PATH
, you can also run:
$ gulp dist
You'll need to configure Apache and WSGI on whatever server you're deploying to, and set up a PostgreSQL database for the application first. Make sure that Apache is configured to use the prefork MPM; the worker and event MPMs result in incorrect responses returned for requests when multiple requests are made to the server.
For more information on deploying Django applications, see the Django documentation.
$ npm run dist
$ scp dist/*.zip <server>
$ ssh <server>
$ unzip -o uf04-backend.zip -d <path/to/python/docroot>
$ unzip -o uf04-frontend.zip -d <path/to/static/files/docroot>
$ chown -R <apache user> <path/to/python/docroot>
$ chown -R <apache user> <path/to/static/files/docroot>
$ cd <path/to/python/docroot>
$ pip install -r requirements.txt
$ python manage.py syncdb --migrate
You may need to use the --settings
option for manage.py
if your
settings.py
is not in PYTHONPATH
.
$ bash bin/build_db.sh
You will need to make sure that whatever user you are executing build_db.sh
as
is recognized by the PostgreSQL database and is the owner of the views being
modified by the script.
Finally, you'll need to restart Apache.
The frontend files can be served statically by any webserver. Make sure that
the STATIC_URL
setting in the backend's settings.py
is set to wherever you
deploy the static files. ([Read more about static files in Django.][static-files])
[static-files]: https://docs.djangoproject.com/en/1.7/howto/static-files/)
The default task runs clean
, fonts
, browserify
, and styles
so that if
you simply execute
$ gulp
from the command line it will build the entire frontend for development.
Compile the SASS, pack the JavaScript, and copy both, along with any fonts into
static/
.
Delete the build/
, dist/
, and static/
directories.
Build the backend and frontend zip files. (Executes dist-py
and dist-ui
.)
Create dist/uf04-backend.zip
which contains requirements.txt
and all of the
Python and SQL files.
Execute collectstatic
and then zip up all of the files contained in build/
.
The zip file is dist/uf04-frontend.zip
.
Start a livereload server and watch SASS and JavaScript files for changes. Run
gulp styles
whenever SASS changes, and gulp browserify
whenever JavaScript
changes.