Pong50887 / RentHub-Connect

3 stars 0 forks source link

RentHub-Connect

Run unit tests Style - PEP8 (currently pycodestyle) Run tests and upload coverage

RentHub-Connect is an application designed to streamline apartment management by integrating booking and payments.

Installation

1. Clone the repository

Run this in your terminal

git clone https://github.com/Pong50887/RentHub-Connect

2. Navigate to the project directory

cd RentHub-Connect

3. Create a virtual environment

python -m venv myenv

4. Activate the Virtual environment

For Mac/Linux

source myenv/bin/activate

For Windows

.\myenv\Scripts\activate

5. Install requirements

pip install -r requirements.txt

6. Create your own .env file

In the sample.env file, we have provided everything necessary to run the file, So you can duplicate and rename it to .env

To create a .env file in terminal

For Mac/Linux

cp sample.env .env

For windows

copy sample.env .env

You'll have to create your own neon.tech Postgre database and Amazon S3 to connect with the application
Follow these tutorial, you only have to get values for your .env
neon.tech Postgre database
Amazon S3 tutorial

7. Migrate

python manage.py migrate

8. Run tests

python manage.py test

9. Load data

Media files First, download awscli

Windows

choco install awscli

Mac/Linux

brew install awscli

log in to your amazon cli

aws configure

input your aws configuration data

If the aws configuration data is correct, then you'd be able to load media/ into S3 with

aws s3 sync media/ s3://<your-bucket-name> --region <your-region-name>

Relational files

For Windows

for %f in (data\*.json) do python manage.py loaddata "%f"

For Mac/Linux

for file in data/*.json; do
    python manage.py loaddata $file
done

if you ran into loaddata errors, you simply rerun those commands again until no error reports appears

Running the Application

1. After you've finished the Installation Tutorial

you can run the application; run this in your terminal from the project directory

python manage.py runserver

if static files did not load properly, quit previous (CTRL+C) and use this instead

python manage.py runserver --insecure

2. Use your web browser of choice

type this in your web browser's URL bar

localhost:8000

or

127.0.0.1:8000

And you should be redirected to the renthub home page

Screenshot 2567-11-23 at 21 45 27

!Caution Some web browser may block the application due to security concerns (like Safari)
Try Google Chrome or Brave.

3. Saving data

Your data are saved to cloud database (neon.tech Postgres, Amazon S3) up-to-date in real-time
But if you want to save your questions and choices locally
To save your data

Windows

python manage.py dumpdata auth.user --indent 4 > data\users.json

Mac/Linux

Windows

for %model in (user, announcement, feature, maintenancerequest, notification, propertyowner, rental, rentalpayment, renter, room, roomimage, roomtype, transaction) do (
    python manage.py dumpdata <yourappname>.%model --indent 4 > data\%model%.json
)

Mac/Linux

for model in user announcement feature maintenancerequest notification propertyowner rental rentalpayment renter room roomimage roomtype transaction; do
    python3 manage.py dumpdata <yourappname>.$model --indent 4 > data/${model}.json
done

To save your media files
First, download awscli

Windows

choco install awscli

Mac/Linux

brew install awscli

log in to your amazon cli

aws configure

input your aws configuration data
If the aws configuration data is correct, then you'd be able to load media into media/ with

aws s3 sync s3://<your-bucket-name> --region <your-region-name> media/  

4. Terminate the running application

Ctrl+C to stop the running web application. If you've accidentally pressed Ctrl+Z and can't run the application again, follow these instructions

  1. Type this in your terminal For Mac/Linux
    sudo is added to execute the command with superuser(root) privileges
    sudo lsof -i :8000
    //The second column of the output is the <PID>

    Then replace in this code below and run,

    sudo kill <PID>
    //or
    sudo kill -9 <PID>

    or

Mac Searching the PID in your Activity Moniter, right click, and press Quit.

For Windows

netstat -ano | findstr :8000
//The last column is the <PID>

Then replace in this code below and run,

taskkill /PID <PID> /F

5. Exit virtual environment

run this in your virtual environment

deactivate

Existing demo users and passwords

Admin

Username password
rhadmin renthub1234

Property

Username password
renthub1 owner123

Renters

Username password
demo1 hackme11
demo2 hackme22
demo3 hackme33
demo4 hackme44
demo5 hackme55

Project Documents

All project documents are in the Project Wiki.

Iteration Plans