diff options
| author | Magnus Hagander | 2017-09-13 13:01:34 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2017-09-13 13:16:34 +0000 |
| commit | 8c16ef8b56cd2f677291310f6aaffa154dc4ef08 (patch) | |
| tree | 8abe50378f76edf9417cf7dc0eac09710e0668de | |
| parent | 678d765726ccef76f985c8f37c74d637e0b62320 (diff) | |
Add script to set up simple development install
This automates a few of the steps for people who don't really know
django, and also deploys an initial configuratoin that works without
integrating with community authentication, making it easy to work with
standlone.
Reviewed and tested by Daniel Gustafsson
| -rw-r--r-- | tools/devsetup/README.txt | 22 | ||||
| -rw-r--r-- | tools/devsetup/dev_requirements.txt | 17 | ||||
| -rwxr-xr-x | tools/devsetup/dev_setup.sh | 54 |
3 files changed, 93 insertions, 0 deletions
diff --git a/tools/devsetup/README.txt b/tools/devsetup/README.txt new file mode 100644 index 00000000..49b635ef --- /dev/null +++ b/tools/devsetup/README.txt @@ -0,0 +1,22 @@ +Dependencies needed before running +---------------------------------- + +The following dependencies are required for manually rebuilding all the required +python modules. If using distribution pacakged python modules most of them won't +be necessary, but then things usually just work out of the box and no need for +this script. + +* virtualenv corresponding to python 2.7 (in path) +* c compiler and libs (typically build-essential) +* python development libraries (typically python-dev) -- for modules +* ffi development libraries (typically libffi-dev) -- for some modules +* openssl development libraries (typically libssl-dev) -- for crypto related modules +* libjpeg-dev and libpng-dev (*before* installing pillow in python) +* pg_config for postgresql, in path, for the correct version. Typically postgresql-dev package. + +Other dependencies +------------------ +For invoice generation to work, DejaVu needs to be installed in +/usr/share/fonts/truetype/ttf-dejavu/ + +On debian, just install ttf-dejavu. diff --git a/tools/devsetup/dev_requirements.txt b/tools/devsetup/dev_requirements.txt new file mode 100644 index 00000000..a751c440 --- /dev/null +++ b/tools/devsetup/dev_requirements.txt @@ -0,0 +1,17 @@ +Django==1.8.18 +Jinja2==2.7.3 +Markdown==2.6.5 +MarkupSafe==0.23 +Pillow==2.6.1 +argparse +cryptography +django-markdown==0.8.4 +django-markwhat==1.4 +flup +httplib2 +psycopg2==2.5.4 +pycrypto +reportlab==3.1.8 +wsgiref +pytz +python-dateutil diff --git a/tools/devsetup/dev_setup.sh b/tools/devsetup/dev_setup.sh new file mode 100755 index 00000000..656ccaca --- /dev/null +++ b/tools/devsetup/dev_setup.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +set -e + +echo "Host/path to postgres:" +read PGH +echo "Port:" +read PGP +echo "Database:" +read PGD +echo "User:" +read PGU + +echo Verifying postgres connection... +psql -w "host=$PGH port=$PGP dbname=$PGD user=$PGU" -c "SELECT 1" >/dev/null + +# Start from script directory to be safe! +cd "${0%/*}" + +virtualenv --no-site-packages venv_dev +venv_dev/bin/pip install -r dev_requirements.txt + +cd ../.. +cat > postgresqleu/local_settings.py <<EOF +DEBUG=True +DISABLE_HTTPS_REDIRECTS=True +DATABASES={ + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': '$PGD', + 'HOST': '$PGH', + 'PORT': '$PGP' + 'USER': '$PGU', + } +} +SECRET_KEY='reallysecretbutwhocares' +SERVER_EMAIL='root@localhost' +SESSION_COOKIE_SECURE=False +SITEBASE="http://localhost:8000/" +EOF + +ln -s tools/devsetup/venv_dev/bin/python . +./python manage.py migrate + +echo +echo Creating a django superuser, and setting password! +./python manage.py createsuperuser + +mv -f template/admin/login.html template/admin/login.html.save_no_communityauth + +echo All ready to go. To start the development server, go to +pwd +echo and run: +echo ./python manage.py runserver |
