Update setup instructions
This commit is contained in:
		
							
								
								
									
										73
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										73
									
								
								README.md
									
									
									
									
									
								
							@ -8,25 +8,43 @@ Kickass map for the Ojuso Project
 | 
			
		||||
 | 
			
		||||
# Getting Started
 | 
			
		||||
 | 
			
		||||
## Install System Dependencies
 | 
			
		||||
 | 
			
		||||
### Debian
 | 
			
		||||
## Check out the code
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ cat system-requirements-debian.txt | xargs sudo apt-get install -y
 | 
			
		||||
$ git clone git@gitlab.com:autonomic-cooperative/ojuso-map.git
 | 
			
		||||
$ cd ojuso-map
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
All commands from here on should be run in the `ojuso-map` directory.
 | 
			
		||||
 | 
			
		||||
## Install System Dependencies
 | 
			
		||||
 | 
			
		||||
### Debian / Ubuntu
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ xargs < system-requirements-debian.txt sudo apt-get install -y
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Fedora
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ cat system-requirements-fedora.txt | sudo dnf install
 | 
			
		||||
$ xargs < system-requirements-fedora.txt sudo dnf install
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If you hadn't previously installed Postgres, you will need to initialise the
 | 
			
		||||
database and start the server:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ 
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Bootstrap the Virtual Environment
 | 
			
		||||
 | 
			
		||||
Get your Python 3 environment on the go:
 | 
			
		||||
Set up your Python virtual environment in the `.venv` folder:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ python3 -m venv .venv
 | 
			
		||||
$ source .venv/bin/activate
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Configure the Environment
 | 
			
		||||
@ -39,6 +57,7 @@ $ export DJANGO_SETTINGS_MODULE=ojusomap.settings
 | 
			
		||||
## Install the Python Dependencies
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ pip3 install --upgrade pip setuptools
 | 
			
		||||
$ pip3 install -r requirements-devel.txt
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -48,15 +67,51 @@ If you run into issues with `psycopg2` you may need to run the following:
 | 
			
		||||
$ pip3 uninstall psycopg2 && pip3 install --no-binary :all: psycopg2
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Ensure Postgres is running and accessible
 | 
			
		||||
 | 
			
		||||
You should be able to connect to Postgres:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ psql -U postgres -h localhost
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
(enter "postgres" as the password)
 | 
			
		||||
 | 
			
		||||
If not, follow [these instructions](https://stackoverflow.com/a/51872624/399367)
 | 
			
		||||
to change the Postgres authentication options (NB on Fedora / Centos,
 | 
			
		||||
`pg_hba.conf` is located in `/var/lib/pgsql/data`), then run:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ echo "ALTER USER postgres WITH PASSWORD 'postgres';" | psql -U postgres
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Run The Migrations
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
```bash
 | 
			
		||||
$ python manage.py migrate
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Run The Tests
 | 
			
		||||
## Start the server
 | 
			
		||||
 | 
			
		||||
``` bash
 | 
			
		||||
```bash
 | 
			
		||||
$ python manage.py runserver
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# Resuming work
 | 
			
		||||
 | 
			
		||||
For each new terminal session, you will need to run:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ cd ojuso-map
 | 
			
		||||
$ source .venv/bin/activate
 | 
			
		||||
$ export DEBUG=1
 | 
			
		||||
$ export DJANGO_SETTINGS_MODULE=ojusomap.settings
 | 
			
		||||
$ python manage.py runserver
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# Running The Tests
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ pip install -r requirements-test.txt
 | 
			
		||||
$ pytest -v
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,3 @@
 | 
			
		||||
gdal-devel
 | 
			
		||||
python3-gdal
 | 
			
		||||
postgresql-devel
 | 
			
		||||
postgis
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user