2021-11-05 01:29:14 +00:00
|
|
|
# api
|
|
|
|
|
2021-11-20 02:03:35 +00:00
|
|
|
The AHosking.com API
|
|
|
|
|
|
|
|
## Getting Started
|
|
|
|
|
|
|
|
###
|
2023-03-25 15:51:36 +00:00
|
|
|
|
2021-11-24 04:56:29 +00:00
|
|
|
1. `sudo apt install libpq-dev python-dev python3-psycopg2`
|
|
|
|
1. `pip install virtualenv`
|
|
|
|
1. `python3 -m virtualenv .env`
|
2021-11-20 02:03:35 +00:00
|
|
|
1. Activate environment
|
2023-03-25 15:51:36 +00:00
|
|
|
`.\.env\Scripts\activate`
|
|
|
|
1. `export DEBUG=false`
|
|
|
|
1. `docker run --name api-postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=api -e POSTGRES_DB=api -p 5432:5432 -d postgres`
|
|
|
|
1. ```
|
|
|
|
export DATABASE_HOST=localhost
|
|
|
|
export DATABASE_PORT=5432
|
|
|
|
export DATABASE_USER=api
|
|
|
|
export DATABASE_PASSWORD=mysecretpassword
|
|
|
|
export DATABASE_NAME=api
|
|
|
|
```
|
|
|
|
1. `python3 manage.py makemigrations`
|
|
|
|
1. `python3 manage.py migrate`
|
|
|
|
1. `python3 manage.py createsuperuser`
|
|
|
|
1. `python manage.py runserver 0.0.0.0:9000`
|
|
|
|
|
|
|
|
## Troubleshooting
|
2021-12-03 18:39:30 +00:00
|
|
|
|
2023-03-25 15:51:36 +00:00
|
|
|
`pip3 install --upgrade --force-reinstall -r requirements.txt` will re-install requirements and upgrade based on requirements.txt
|
2021-12-03 18:39:30 +00:00
|
|
|
|
|
|
|
### Third-party
|
|
|
|
|
2023-03-25 15:51:36 +00:00
|
|
|
- https://pypi.org/project/django-4-jet/
|