This is the code for the Python Edinburgh website. It is built with Python and Django.
The site has been designed to run on Heroku in production, and under Vagrant in development. You can run it without Vagrant, but that's not really recommended.
To get up and running, install
Vagrant and
Ansible
(easiest to do with pip install ansible
), then run vagrant up
.
This will set up a VirtualBox
virtual machine, install and configure PostgreSQL and Python 3. It will also
set up virtualenvwrapper and create a virtual environment called pew
with
all the development dependencies installed into it.
To start working with your installed site, do the following:
vagrant ssh
workon pew
The site is built as a 12 Factor app, so configuration
is passed in via environment variables. To make it easier to work with locally,
configuration can be stored in a file in the top-level directory called .env
.
The following will work in the Vagrant VM:
DEBUG=True
DATABASE_URL=postgres://pew:pew@localhost/pew
SECRET_KEY=this-doesn't-matter-for-development
Once you have created your .env
file, run the following commands:
dj migrate # This will run the project's migrations on the development db.
djr # This alias runs the Django development server.
Run make test
to run the code checks & unit tests and print a coverage
report. The alias djt
will also run the tests without the coverage report or
quality check.
The site's homepage can be browsed at http://localhost:18000/
if you are
running the Vagrant VM. The admin site is configured to run at /admin
.