Personal Travel Recommendation Model
-
Open Command Prompt:
- Press
Win + R
, type "cmd", and pressEnter
to open the Command Prompt.
- Press
-
Create Virtual Environment:
python -m venv venv
-
Activate Virtual Environment:
.\venv\Scripts\activate
-
Install Requirements:
pip install -r requirements.txt
-
Deactivate Virtual Environment:
deactivate
-
Open Terminal:
- Press
Cmd + Space
to open Spotlight Search. - Type "Terminal" and press
Enter
to open the terminal.
- Press
-
Create Virtual Environment:
python3 -m venv venv
-
Activate Virtual Environment:
source venv/bin/activate
-
Install Requirements:
pip install -r requirements.txt
-
Deactivate Virtual Environment:
deactivate
- Replace
python3
withpython
if your default Python version is Python 3 on macOS. venv
is the name of the virtual environment folder. You can use a different name if you prefer.- The
requirements.txt
file should contain a list of your project dependencies. - The
activate
anddeactivate
commands are used to activate and deactivate the virtual environment, respectively.
- Ensure your PostgreSQL database is created and running.
-
Locate the existing Python script:
backend/app/popuST.py
. -
Open a terminal or command prompt.
-
Navigate to the script's directory.
-
Run the script:
python popuST.py
- Visit the official PostgreSQL website & download the installer appropriate for your operating system: https://www.postgresql.org/download/
- Keep the default install directory
- Uncheck StackBuilder from "Select Components".
- Keep default Data Directory.
- Set superuser password - Remember It
- Keep default port (5432).
- Keep Default Locale - Language option
- Open Servers drop down menu.
- Enter the password from installation when prompted.
- Right-click on the "Database" in the dropdown menu.
- Select Create -> Database...
- Name database: itinero_db
- Save
- Double check database is initialized correctly by going back to the dropdown menu and selecting the newly created database.
Make sure you have Python and Pip installed on your system. This project works with Python 3.11.6+ and should by default already come with pip installed.
pip install django psycopg2-binary
- In backend/django/itinero directory edit the database line in the Settings.py file and add your password to the field.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ.get('DB_NAME', 'itinero_db'),
'USER': os.environ.get('DB_USER', 'postgres'),
'PASSWORD': os.environ.get('DB_PASSWORD', ''),
'HOST': os.environ.get('DB_HOST', 'localhost'),
'PORT': os.environ.get('DB_PORT', '5432'),
}
}
cd backend/django/itinero
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
Now your Django project is set up with a PostgreSQL database. You can access the development server at http://127.0.0.1:8000/
.
- Login: http://127.0.0.1:8000/login
- Register: http://127.0.0.1:8000/register
The path file containing the current model state of the 'CrimeClassifier' feature is too large to add to the repository. Therefore, it is necessary to download Git Large File Storage (LFS) from: https://git-lfs.com/. This Git extension will be automatically added to your native 'git' path on your PC.
Once you have pulled the most recent code into your repo, with Git LFS installed, go to your repo's terminal/console and run:
git lfs install
git lfs fetch
*Note: - It is only necessary to run the commands above when Git LFS has NOT been set up yet, after that, a simple pull request will suffice.
Any and all functions of the CrimeClassifier feature are defined within the 'itinero_model.py' file within "Itinero/backend/app"
In short, as long as you import the file and class at the top of your code...
from itinero_model import CrimeClassifier
...and you create an object instance of the class:
crime_classifier = CrimeClassifier()
You can use any of its functions freely.