Skip to content

Commit afd2976

Browse files
tang-mmdwilding
andauthored
Add Makefile for basic commands (#6)
* create Makefile for basic commands * update make commands in readme * Fixed spacing in Makefile * Temporarily renamed readme to avoid merge conflict --------- Co-authored-by: David Wilding <david.wilding@canonical.com>
1 parent 86a2cbb commit afd2976

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Variables
2+
VENV := .venv
3+
PYTHON := python3
4+
PIP := $(VENV)/bin/pip
5+
PYTEST := $(VENV)/bin/pytest
6+
MANAGE := $(VENV)/bin/python ./manage.py
7+
8+
.PHONY: all help clean venv install migrate init test run
9+
10+
help:
11+
@echo "Available targets:"
12+
@echo " install - Create virtualenv and install dependencies"
13+
@echo " migrate - Setup database tables"
14+
@echo " init - Load initial test data"
15+
@echo " run - Start development server"
16+
@echo " test - Run automated tests"
17+
@echo " clean - Remove virtualenv and cache files"
18+
19+
venv:
20+
$(PYTHON) -m venv $(VENV)
21+
22+
install: venv
23+
$(PIP) install --upgrade pip
24+
$(PIP) install -r requirements.txt
25+
26+
migrate: install
27+
$(MANAGE) migrate
28+
29+
init: migrate
30+
$(MANAGE) loaddata initial_data.yaml
31+
32+
run: init
33+
$(MANAGE) runserver
34+
35+
test: install
36+
$(PYTEST)
37+
38+
clean:
39+
rm -rf $(VENV)
40+
find . -type d -name "__pycache__" -exec rm -r {} +
41+
find . -type f -name "*.pyc" -delete

readme_with_make.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
=========
2+
Dashboard
3+
=========
4+
5+
A Django-based database-driven web application, to track the progress of projects against a set of criteria to measure quality and progress.
6+
7+
.. image:: https://raw.github.com/canonical/dashboard/readme-image/screenshots/dashboard.png
8+
9+
10+
Launch a development version of the application
11+
===============================================
12+
13+
14+
Installation
15+
--------------
16+
17+
::
18+
19+
git clone git@github.com:canonical/dashboard.git
20+
cd dashboard
21+
make install
22+
23+
This will create a Python virtual environment in ``.venv`` and install the required dependencies.
24+
25+
Database setup
26+
~~~~~~~~~~~~~~~~~
27+
28+
Create the database tables and initialize them with some test data
29+
30+
::
31+
32+
make init
33+
34+
The above command executes two separate steps. If you want to run them separately, you can do so with:
35+
36+
1. Create the database tables::
37+
38+
make migrate
39+
40+
2. (Optional) Load data into the database. For convenience some data are provided in ``initial_data.yaml``, and can be loaded with::
41+
42+
source .venv/bin/activate
43+
./manage.py loaddata initial_data.yaml
44+
45+
46+
Launch the site
47+
~~~~~~~~~~~~~~~
48+
49+
::
50+
51+
make run
52+
53+
Explore the dashboard at http://localhost:8000/ or
54+
login to the admin http://localhost:8000/admin (if you loaded the provided initial data, use admin user ``test``, password ``test``).
55+
56+
Nearly every cell in the dashboard is a link to the relevant admin view. The most interesting admin view is for *Projects*, for example http://localhost:8000/admin/projects/project/2/change/.
57+
58+
59+
Automated tests
60+
===============
61+
62+
Some automated tests are included and can be executed by running::
63+
64+
make test

0 commit comments

Comments
 (0)