-
Notifications
You must be signed in to change notification settings - Fork 0
Development Setup
The plan is to have a CI setup, with local development done by Carl in Didcot, pushing changes to the GitHub COPE repository, which will link to a Travis CI environment, and that in turn will link to a preview site running on my web server, before finally having a production server to push the live results to.
Setup progress:
- Local Dev setup - see below
- GitHub COPE repository - see this site. Mostly done.
- Travis CI - not yet, need the admin access to enable a link across. May not be an option easily for this being a private project. Need to investigate.
- Preview Site - not done.
- Production Site - no clue as to where that will be. Can be investigated after we get the preview site working.
Key technologies:
- Language: Python 2.7 (considering doing a 3.3 build later)
- Core Framework: Django 1.8
- UI Framework: Bootstrap 3.3
- Datastore: SQLite3 initially, then onto Postgres 9
Locally developing on Mac OS X 10.10.3, using PyCharm for my IDE, VirtualEnv for project isolation, Homebrew for Postgres and non-python package management.
Previous (early example) work was done on a Windows 7 Virtual Machine, using VS2013 and C#, ASP.net, MVC5 & EF6. Dropped that in favour of the more flexible and faster working afforded by python development.
Based loosely on standard practice, plus [http://michal.karzynski.pl/blog/2013/09/14/django-in-virtualenv-on-webfactions-apache-with-mod-wsgi/]
Webfaction hosted, Control Panel actions:
- Create DNS entry (wp4.cm13.net)
- Create mod_wsgi application (mod_wsgi 4.4.11/Python 2.7 as wp4_django)
- Create symbolic link application (wp4_static, pointed at /webapps/wp4_django/static/)
- Create website with wp4_django at /, and wp4_static at /static/
CLI actions:
- ssh into account home. cd
~/webapps/wp4_django/
-
rm -rf htdocs/
- remove the redundant htdocs folder -
mkvirtualenv wp4_20150514
- create the the virtual environment for the hosting -
touch ~/.virtualenvs/wp4_20150514/lib/python2.7/sitecustomize.py
- to make pip use the local environment only - Deactivate and start again (
workon wp4_20150514
) -
git clone git@github.com:AllyBradley/COPE.git
to get the codebase -
cd COPE
to get into the repository -
git checkout testing
to get to the relevant branch -
pip install -r deploy/requirements.txt
to get the libraries installed. Results in:Successfully installed Django psycopg2 docutils django-dbbackup ipython pysftp paramiko pycrypto ecdsa
-
cp apache2/conf/httpd.conf apache2/conf/httpd.conf.orig
to backup the template config -
ln -s ../../.virtualenvs/wp4_20150514/lib/ ./lib
to make the local packages available in the near python path -
vi apache2/conf/httpd.conf
-- see example below -
cd COPE/src/wp4/wp4/
so that we can go edit the project's settings cp settings_local.py.template settings_local.py
-
vi settings_local.py
-- see example below -
../../../../apache2/bin/restart
restart the apache instance to load all the new settings -
cd ..
to the project root, so we can work with django management
Python actions (also cli): (NB: "pm" is an alias for "python manage.py")
-
pm check
- should produce zero issues -
pm migrate; pm createsuperuser
to setup the database and the admin account ../../../apache2/bin/restart
-
pm loaddata hospitals
andpm loaddata persons
to add the fixture data in
And lo there is a test site active.