79 lines
2.2 KiB
Markdown
79 lines
2.2 KiB
Markdown
## Summary
|
|
|
|
Holiday lettings website
|
|
|
|
## Local development
|
|
|
|
### Prerequisites
|
|
|
|
- GitHub account with read access to this repository
|
|
- Git CLI
|
|
- SQLite3 CLI
|
|
- Python interpreter, version 3.6 or higher.
|
|
|
|
In the rest of the local development documentation, it is assumed the command `python` in
|
|
your OS shell runs the above Python interpreter (unless a virtual environment is activated)
|
|
|
|
### macOS / Linux
|
|
|
|
#### Clone the repository
|
|
|
|
- `cd /path/to/put/project/in`
|
|
- `git clone https://github.com/grking8/oc-lettings-site.git`
|
|
|
|
#### Create the virtual environment
|
|
|
|
- `cd /path/to/oc-lettings-site`
|
|
- `python -m venv venv`
|
|
- `apt-get install python3-venv` (If previous step errors with package not found on Ubuntu)
|
|
- Activate the environment `source venv/bin/activate`
|
|
- Confirm the command `python` now runs the Python interpreter in the virtual environment,
|
|
`which python`
|
|
- Confirm the version of the Python interpreter is 3.6 or higher `python --version`
|
|
- Confirm the command `pip` runs the pip executable in the virtual environment, `which pip`
|
|
- To deactivate the environment, `deactivate`
|
|
|
|
#### Run the site
|
|
|
|
- `cd /path/to/oc-lettings-site`
|
|
- `source venv/bin/activate`
|
|
- `pip install --requirement requirements.txt`
|
|
- `python manage.py runserver`
|
|
- Go to `http://localhost:8000` in a browser
|
|
- Confirm the site is running and can be navigated (you should see several profiles and lettings)
|
|
|
|
#### Linting
|
|
|
|
- `cd /path/to/oc-lettings-site`
|
|
- `source venv/bin/activate`
|
|
- `flake8`
|
|
|
|
#### Unit tests
|
|
|
|
- `cd /path/to/oc-lettings-site`
|
|
- `source venv/bin/activate`
|
|
- `pytest`
|
|
|
|
#### Database
|
|
|
|
- `cd /path/to/oc-lettings-site`
|
|
- Open a shell session `sqlite3`
|
|
- Connect to the database `.open oc-lettings-site.sqlite3`
|
|
- Display tables in the database `.tables`
|
|
- Display columns in the profiles table, `pragma table_info(oc_lettings_site_profile);`
|
|
- Run a query on the profiles table, `select user_id, favorite_city from
|
|
oc_lettings_site_profile where favorite_city like 'B%';`
|
|
- `.quit` to exit
|
|
|
|
#### Admin panel
|
|
|
|
- Go to `http://localhost:8000/admin`
|
|
- Login with user `admin`, password `Abc1234!`
|
|
|
|
### Windows
|
|
|
|
Using PowerShell, as above except
|
|
|
|
- To activate the virtual environment, `.\venv\Scripts\Activate.ps1`
|
|
- Replace `which <my-command>` with `(Get-Command <my-command>).Path`
|